Questions tagged [xpath]

XPath was developed with the main objective of targeting specific sections within an XML document. In addition, it offers essential functionality for modifying strings, numbers, and booleans. With its concise and non-XML syntax, XPath enables seamless manipulation. Instead of focusing on the surface-level formatting, XPath delves into the underlying logical structure of an XML file.

Ways to obtain the XPath

If you don't already have an account, you can easily sign up by clicking on the "Sign up" button. However, I am having trouble locating the xpath for this web element and keep receiving an error message saying "Unable to locate element". I have tried ...

Mastering the art of selecting a web element using xpath with Python and Selenium

Struggling with web scraping on a site featuring this specific structure. <div> <div class = “class1” > <div class = “class2” > <div class = “class3” > <div style = “clear: both; ” > </div&g ...

Locating the Xpath value amidst nodes

I've been struggling to extract a specific value between Xpath nodes. Despite my efforts, I haven't been able to pinpoint and capture that value using Xpath. <span class="passwordmessage" id="PasswordMessage" name="PasswordMessage"></span> & ...

Having trouble interacting with element - Selenium WebDriver is not allowing the click

I'm attempting to select the Checkout Button. This is what it looks like : https://i.stack.imgur.com/TiMEO.png And here's the HTML snippet for it : <div id="buy-button-next"> <span data-reactroot=""> <div data-cid="buy- ...

In order to locate the xpath for the language dropdown menu on the Google sign-in page

Dropdown button on Signin page When the dropdown button is clicked, a list of languages is displayed. I am trying to store these languages in a list and then iterate through them using a for loop to select one. I have attempted various methods to create ...

Ways to Provide Dynamic Input in Xpath

Welcome to my blog with my very first question here! I am currently working on Selenium automation with C# and have encountered an issue. I need to click on a checkbox that is not static and the ID keeps changing. To handle this, I have decided to use XPA ...

Obtaining table data and HTML elements using the correct code - Selenium and Python

I've been attempting to extract the ticker symbol, stock name, price, sector, and market cap columns from this website. I'm facing challenges in identifying the correct HTML elements using the appropriate code. Although I've used Selector Gadget to locat ...

Guide to finding a specific element on a website with Selenium and Python 3.6

Currently, I am working on a Python script to automate a process in Selenium. This is my first experience with xpath and I am puzzled as to why the xpath I obtained from Chrome web inspect (F12) is not working. The xpath I copied after clicking on the text ...

Attempting to extract only the text content from a specific div using XPath

I am currently facing a challenge in writing a script to extract the title element from a poorly coded webpage. The developer who created this website did not use any classes, only div elements. Below is a snippet of the source code I am trying to scrape: ...

Using Python and Selenium to interact with dropdown menus in the browser

Being new to this, I've reviewed some of the examples provided here but despite their simplicity, I'm still struggling to make it work. The website I am trying to navigate is: www.webauto.de Below is my code for selecting a car make, model, and clicking ...

Python - Extracting text content with Selenium from a text node

When utilizing Selenium and Python to scrape data from a website, I often encounter unlabelled texts such as HZS stonks remaining.... These texts do not have any identifiable name or label that allows me to extract them: Although I can easily access eleme ...

What is the best way to select and click a button located in the same row as a <td /> element with certain text using Selenium?

I need to automate clicking a button within a row that contains a specific text in one of the columns. This is how the structure looks like: <tbody xpath="1"> <tr role="row" class="odd"> <td class=" grdI ...

Tips for extracting text from a multiline tag using Selenium

I need help extracting the text "1 file has been successfully uploaded" from the code snippet below: <div class="formbuttons"> <h3 id="res" class="demo" style="color: rgb(255, 255, 255); display: block;"> <center>1 file <br>has bee ...

How can I exclude specific lines from an XML file using filters?

Let's say I have the following data: <div class="info"><p><b>Orange</b>, <b>One</b>, ... <div class="info"><p><b>Blue</b>, <b>Two</b>, ... <div class="info"><p><b& ...

Selenium Webdriver | Element with 'href' attribute cannot be found

I have been attempting to find a specific link using Selenium Webdriver with Xpath and CSS. <table width="100%" cellspacing="0" cellpadding="0" border="0"> <tbody> <tr> <tr> <td class="cspbItmA"> <a class="cspbItm" target= ...

When using WebDriverIO in combination with VSC and JavaScript, any Xpath starting with //* is recognized as a comment

I'm in the process of creating a UI framework utilizing WebDriverIO within VSC. So far, everything is running smoothly, but I've encountered an issue where using XPath like the one below results in everything after //* being interpreted as a comm ...

"Selenium encounters a NoSuchElementException when trying to interact with a dropdown menu located inside an

I have been trying to access the voter list database through this link Unfortunately, I am unable to retrieve the first drop-down menu. I am currently using selenium version 3.14 This is the code that I have written: user_agent = "Mozilla/5.0 (X11; ...

Input a code, select a label, and finally, click on a button using Python Selenium

I need to input a code into a search bar, click on a specific label, and then click on a button on a webpage found at . The process involves entering the code in the search bar (where the prompt "Inserisci i dati dell'azienda" appears), clic ...

Analyzing the Hover functionality through Selenium Testing

Currently, I am working on testing the change in background color to #F67621 when hovering over an element. In this case, the background color code needs to be compared with a predefined expected value using XPath as the selector. String xPathStr="//input ...

Having issues with Chropath for Selenium Xpath not functioning properly?

After installing chropath to help me find the xpath for websites, I tried to locate the username field on a specific website using Selenium from selenium import webdriver from selenium.webdriver.common.keys import Keys driver = webdriver.Chrome("C:\ ...

Selenium - Element not located using xpath

Searching for a particular element in this webpage, specifically the bid price in the initial row: 196.20p. Utilizing selenium, here is the code I am using: from selenium import webdriver driver = webdriver.PhantomJS() address = 'https://www.trustnet.com ...

Guide on clicking the SIGN IN button with Selenium and C#

Currently, I am working on creating a test scenario where users will go to a specific URL, input their login details, and then proceed to sign in by clicking a button. Everything is functioning correctly except for the button click action. I have attempted ...

Is it possible to target a specific element within one of two classes that share the same name using CSS or XPath in Webdriver.IO?

Currently, I am using Webdriver.io and facing a challenge in selecting an element within the "text-fields-container" class. This particular element happens to be a password field, and both classes share the same name. Can someone guide me on how to go abou ...

Harness the power of Selenium to gather up all items listed in an Unordered list

My current project involves creating a Selenium Python script that can pinpoint a specific location on the map website openstreetmap.org based on user input, such as "Moscow". Additionally, the script should be able to select a particular graphic layer for ...

Press the login button with Selenium

I'm encountering an issue with clicking on a website. I keep receiving a NoSuchElement Exception error, even though I have the correct class name from the site. What could I be overlooking? from selenium import webdriver from selenium.webdriver.common.by ...

I am currently using Selenium XPATH to find a specific element in column 2 of an HTML table based on the text value in column 1

I am currently working with a HTML table that contains an input value "AREACODE" in column 1, and a select element (a drop down field) in column 2. I am facing a challenge in locating the select element that is in the same row as the input value "AREACODE" ...

Waiting for an Element to Become Visible in Selenium-Webdriver Using Javascript

When using selenium-webdriver (api docs here), how can you ensure that an element is visible before proceeding? Within a set of custom testing helpers, there are two functions provided. The first function successfully waits for an element to exist, howeve ...

Tips on selecting an element with xpath in Selenium WebDriver (It usually does the trick, but not working on this particular URL)

Attempting to access an input field on the website by utilizing xpath. Normally, this method works for all URLs, but for this specific one, I am unable to click on the input field using selenium webdriver. The webdriver successfully loads the page but fai ...

Using Python with Selenium to automate clicking the next post button on Instagram

Having trouble navigating to the next post on my Instagram bot. Here are my attempts: #First Attempt next_button = driver.find_element_by_class_name('wpO6b ') next_button.click() #Second Attempt _next = driver.find_element_by_class_name(' ...

Selenium reports an error with the xpath used for the span element,

HTML : <div class="accept"><a class="red_keep popup_action"><span>Tap here to see the terms</span></a></div> Xpath attempts : 1. //span[text()='Tap here to view terms'] 2. normalize-space(//href[@class="red_keep popap ...

Having trouble getting the XPath selector to function properly with the Robocorp Selenium library

For my web automation project, I am utilizing Robocorp along with the Selenium library. Everything runs smoothly until I reach a particular page where I need to click on an icon labeled SQL. I specifically require the <a> element with the @href att ...

Struggling to locate the Twitter direct message input box with Xpath in Selenium

I have been struggling to locate the textbox element using the find_element_by_xpath() method. Unfortunately, every time I try it, I receive an error stating that the element cannot be found. Here is the specific line of code in question: Despite attempti ...

What is the correct way to implement a variable in xpath with Selenium WebDriver using Java?

How can I incorporate variables into XPath while using Selenium WebDriver with Java? Below is the snippet of my code: for(int row =1; row<=20; row++) { driver.findElement(By.xpath(“//*[text()=’PickRequest’]/table/tbody/tr[+row+]/td[2] ...

Having trouble navigating to the element within the frame on Selenium using Java

I have been using Selenium for testing web pages, and currently I am working on a webpage that contains frames. The structure is as follows: <frameset title="Application Content"> <frame name="main" src="qweMain.jsp?langua ...

How to use XPath in Python to extract and separate text from a href within the same td element

My webpage contains HTML code similar to this: <tr><td style="text-align:center;">7</td><td class="multi_row" style="line-height:15px;">Loaded on 'NYK LEO 303W' at Port of Loading<br> <a href="JavaScript:void(0); ...

Having trouble selecting or clicking a button in a modal that appears after a try:except block in Selenium

I am encountering a problem where I cannot click on a button within the modal. The modal only appears when my selenium script is running, not when I navigate the webpage manually. Interestingly, the modal consistently appears when my script runs in try/exc ...

What is the proper method for interacting with elements using Selenium in Python?

I am currently facing a challenge in trying to streamline my code for web scraping on eBay's website. The specific situation that I am stuck in involves starting from the following URL: https://www.ebay.co.uk/sch/i.html?_from=R40&_nkw=iphone+12&_oa ...

The Xpath used to locate the newsfeed box on Facebook is malfunctioning

I am currently attempting to accomplish the following tasks using Selenium WebDriver with Java: Logging in to Facebook Clicking on the username Posting the word "How are you!!" as a newsfeed update While the first two steps are successful, the third ste ...

The Selenium code is encountering difficulty retrieving the text from an element

I'm attempting to retrieve the website owner using my local whois with the following code: link = "ebdicorp.com.br" service = service.Service('C:\Selenium\chromedriver.exe') service.start() capabilities = {'chrome.binary' ...

Is there a potential security measure that can deactivate automation processes?

I'm currently developing a Python script using the Selenium Chrome Webdriver to automate tasks on this specific Swedish website: . My main focus is automating the login process, however I have encountered some persistent errors such as: selenium.common.ex ...

Having trouble locating and clicking an element using Selenium and Java

On the page, there is a specific button that needs to be clicked: <div _ngcontent-jnk-c107="" class="btn btn-primary btn-outline" tabindex="0" ng-reflect-router-link="/opportunity/1">VIEW</div> Identifyi ...

Executing a click on the popup element in Chrome with Selenium and Python

While running my automation code, I encountered a frustrating webpage. Each time I click on an element, a new browser window pops up along with an alert message. Unfortunately, the alert seems to be unbreakable and I'm stuck unable to proceed further. D ...

Using a combination of AND and OR in XPATH

Recently, I encountered the following HTML code: <div><h6>abc/h6><p>date</p></div> Using Selenium, I managed to locate this element based on text. However, the issue arises when <h6> can contain various words like "d ...

Searching for an element using Xpath and need to remove unwanted elements within the Xpath

I am currently using Selenium to scrape a website. However, I have encountered an issue when trying to retrieve the coins' names because there are 2 elements inside each 'td'. How can I eliminate the unwanted element or only select the first ...

Selecting the optimal automation tool combination that works well with SeleniumDiscovering the

Having used Selenium webdriver, Maven, and Java for automation frameworks in the past, I am now considering exploring other tools such as WebdriverJS, WebdriverIO, and NodeJS. I have heard that using WebdriverJS/WebdriverIO/NodeJS can result in faster exe ...

selenium.common.exceptions.InvalidArgumentException: Error: the specified argument is not valid - incorrect locator provided

Hey there, I've been working on creating a bot using selenium and encountered an issue with the send keys function. Despite trying for hours, I can't seem to figure out how to make it work. If anyone has any insights or solutions, I would greatly ...

Having trouble selecting content in an HTML document using Xpath and response.css with Scrapy?

Something is quite puzzling me and I've been pondering over it for almost a week now. Perhaps the solution is staring right at me and I just can't see it clearly... Any hints for alternative approaches would be greatly appreciated. I have no control ...

Using dryscrape for web scraping: encountering an issue when selecting a radio button with CSS

I am attempting to extract data from a dynamically updated table on a webpage using dryscrape. The web page in question is located at . My code functions correctly with tables that are generated when the page is loaded initially. However, I now need to upd ...

Having difficulty locating an element that includes certain text

There is a snippet of code from the page: <label> <input type="checkbox"> </input> " some text" </label> I am trying to locate an element that contains the text "some text". If I use WebElement().ByXPath("//div/label[ ...

What is the best method for extracting [object Text] using XPath?

I'm currently working with Selenium and attempting to extract text from a node that contains the keyword "approved," but I'm unsure of how to retrieve and validate this specific text. Here is the node structure - <div class="Notification-body"> ...

Avoid using a dollar sign in a Selenium xpath locator

I need help finding an element that has the attribute $9a, but I am encountering issues because of the dollar sign. Here is the XPath expression I tried to use: //td[@id='isc_6T']//span[@$9a='browse'] However, I received an exception with the following m ...

Steps for precisely locating an element within a table using Selenium

Is there a reliable method for finding the element "1988" (the fourth line) in the table below? <table border="0" width="820" cellpadding="2" cellspacing="0"> <tbody> <tr valign="top"> <td class="default" width="100%">R ...

Tips for extracting the text from the initial URL of a soccer games lineup with Selenium and Python

Hello, I am attempting to execute a Python script on an Apache2 server running Ubuntu. Below is the configuration of the server taken from the file 000-default.conf: <Directory /usr/lib/cgi-bin/> Options Indexes FollowSymLinks ExecCGI AddHand ...

Are DIV elements really impossible to click using selenium Web Driver?

Can DIV elements be clicked using selenium Web Driver? For example, I'm having trouble clicking the delete button in Gmail. https://i.stack.imgur.com/zsyio.png I've been trying to locate the element using the XPATH = //div[@aria-label='Delete'] https:/ ...

Retrieve the content of the specified element within the webpage

How can I modify the method to successfully retrieve the text content of an element on a webpage using Selenium with JavaScript? Currently, it is returning undefined. homepage.js const { Builder, By, Key, until } = require('selenium-webdriver'); ...

Python Scripting for Selenium Automation

After recently diving into the world of selenium with Python, I decided to put together a sample test script: from selenium import webdriver def browser(): driver= webdriver.Firefox() driver.delete_all_cookies() driver.get('http: ...

Error encountered: In a headless browser on Ubuntu using Python, the element is not visible when attempting to invoke the send_keys method

I'm experiencing issues with the send_keys method. options = webdriver.ChromeOptions() options.add_argument('headless') driver = webdriver.Chrome(executable_path= '/home/ec2-user/chromedriver', chrome_options=options) base_url = "https://www.xxxxxxxx.com/ ...

Choose a checkbox by targeting a specific column value with XPath

While automating the testing with Selenium, I encountered an issue related to selecting a checkbox in a table row. To resolve this problem, I turned to XPath for assistance. Specifically, I needed to choose the row based on the file name. Below is the rele ...

Is there a way to modify System.out.println to only retrieve links that have child p tags in Java

How do I make System.out.println show only links with /p/ in them? I am working on a program to display all links by hashtag on Instagram. I have managed to parse all links with the "a" tag. How can I now filter out links that do not contain /P/? ...

Utilizing XPath with Selenium in VBA

In my search for a node based on text located within a child or grandchild node of its immediate sibling, I came across the following HTML structure: <div> <div class="searchedDivClass" id="DynamicId1"> </div> <div class=" ...

The equivalent of xpath not contains in Selenium WebDriver is using CSS selectors

Seeking alternatives to xpath in my Java Selenium code, I'm unsure of the CSS equivalent for the following code: ("xpath", "//div[@class='error'][not(contains(@style,'display: none'))]"); Is there a CSS alternative to xpath' ...

Extracting multiple elements from XPath using Selenium in Python

After creating this XPath expression, I am encountering an issue where only the first element is being retrieved. However, there are actually 3 or 4 elements with the same XPath that I need to capture. The number of elements can vary from page to page, ra ...

Identifying the specific button within an Angular table that is part of a collection of buttons all sharing the same ID

I am currently working on writing a Selenium test using C# for the specific scenario outlined below. The task at hand involves clicking the undo button on selected records within the table based on their transfer type. https://i.stack.imgur.com/CwNMb.jpg ...

Discovering a way to extract the URL link for the "View Deal" option and the deal price from Kayak.com through BeautifulSoup

Currently seeking assistance with extracting price and deal link data from a list of Kayak URLs. Specifically, interested in retrieving information from the "Best" and "Cheapest" HTML cards, which correspond to the first two results after sorting the URLs ...

"Receiving an error that Element cannot be clicked at a specific point in Chrome while using Webdriver

There's a well-known bug that I've been trying to avoid in three different ways: checking for overlapping elements, setting sleep time for complete page download, and verifying element visibility. Despite my best efforts, none of these methods se ...

Navigating the Yahoo login process using Selenium with Python (testing various techniques)

Currently, I am experimenting with logging into my Yahoo account using Selenium. This is part of my learning process as I am trying to familiarize myself with Selenium by creating programs for various websites. Despite my efforts, I have encountered diffi ...

Exception thrown when Selenium encounters a timeout while trying to locate an element by

Having an issue with Selenium regarding a specific DOM structure: <div class="window__popup" style="display: block; transform: translateY(0px);"> ... <div id="user_product_name" class="input__block"> ... <input type= ...

What steps can be taken to locate an element by its link text even when encountering a NoSuchElement Exception?

Despite numerous attempts and hacks, I am still struggling to identify the issue in this recurring question. I have increased the implicit wait time to 30 (and even tried up to 100) without success. Use case -: My goal is to compile a list of all items o ...

Having trouble creating the right XPath for the top movies on IMDB using Selenium

I'm having trouble clicking on the Top Rated Movies section within "Movies, TV & Showtimes" on IMDB. I'm unsure of how to write the correct xpath for it and can't seem to figure out how to click on it. Below is the snippet of code I am using: driver.get( ...

Retrieve the first span element using Selenium

I am struggling to extract the content from the first span that contains the text Extract this text. Here is what I have tried so far: element.find_element_by_css_selector(".moreContent span:nth-child(1)").text.strip('"') Unfortunately, this code is not ...

Searching for an element by a partial elementId or UID using XPath in Appium

Currently, I am engaged in automating a test for an iOS application. I am utilizing the Appium desktop client (version 1.15.1) on MacOS (version 10.15) to find an element on iPhone 11 (iOS version 13.3) using the Inspector with specific attributes: view th ...

Exploring the functionalities of double dots with Selenium

While utilizing Selenium to access a DOM element, I encountered some confusion with double dots in xpath. To clarify: .. (double dots) - this will select the parent of the current node. I also came across an article that elaborates on "Using doubl ...

Tips on how to use Selenium and Java to successfully click on the "logout" link in HTML

Below is the code snippet: <div id="user-tools"> Welcome <strong>Admin</strong> / <a href="/">View</a> / <a href="/admin/password_change">Change password</a> / </a href="/admin/l ...

Can you provide the correct xpath syntax for utilizing the contains text function?

Can you review my xpath code below? By.xpath(".//div[contains(@class, 'foo123') and contains(text(), 'foo bar')]") I am attempting to locate the specified HTML element: <div class="foo123">foo bar</div> Do you see any er ...

Find an XML element that shares a common attribute with another element at the same level

Is there a way to extract the href attribute value from certain nodes based on the presence of another node with a specific attribute? Specifically, I want to retrieve the links from all nodes that come after a span node with the class attribute set to " ...