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.

Extracting the href attribute following a specific th element in a Wikipedia infobox using Python with the help of Selenium or lxml

I am facing an issue with extracting the href of a specific cell in the infobox on a Wikipedia page (refer to the image below). I am particularly interested in obtaining the href of 3M's official website located after the table's row header "Website". The ...

Is it possible to apply a CSS property to an XPath locator in order to guarantee the visibility of an element?

One of the challenges I'm facing involves a series of div blocks that can be clicked to reveal hidden content in an accordion format. Using Selenium, my goal is to cycle through these blocks, opening each one before capturing a screenshot. However, I am s ...

pursuing the team (without achieving the expected components)

My attempt to scrape data from a website using Selenium is facing an issue. Despite removing the text that contains "team," Selenium fails to detect this element. Why is it not grabbing all the elements following "team"? Is there a better way or a method l ...

I need to know the steps to extract text elements with Python's Selenium

Consider: https://i.stack.imgur.com/dA0DD.png I am currently utilizing Selenium to extract data from the AppĀ Store: My objective was to retrieve the text field that reads, "As subject matter experts, our team is very engaging..." I attempted to locate ...

A guide to automating button clicks in tests with Selenium and Java

I am currently automating a test using Selenium and I am attempting to click a button using xpath. Here is the snippet of my code: WebElement LogInButton = driver.findElement(By.xpath("/login")); LogInButton.click(); Unfortunately, when running this code ...

A guide on retrieving the Subtotal Price with Selenium and Python

Struggling with extracting the necessary information using Xpath. Specifically, it involves obtaining the Price - Subtotal from the HTML Image attached. The xpath code I have been using is provided below. What could be missing? Ultimately, my goal is to st ...

Could we identify a shared xpath for these elements?

The xpath for one element is: //div[@class='name-slider-header']//button//img[2] The xpath for another element is: //div[@class='name-slider-header']//button//img[1] My goal is to verify that the attribute of an element contains "red" after it becomes di ...

Guide to interacting with webpage elements using Selenium and Python to trigger them based on their HTML properties

I have been struggling to locate this specific element using Python Selenium. Despite trying various methods like xpath, CSS selectors, and classes, I have not been able to find the element in question. Could anyone provide guidance on how to locate and cl ...

Creating an xpath with ::before and ::after pseudo-elements in selenium

Line 1 -> <input _ngcontent-huh-c120="" name="options" id="line" type="radio" ng-reflect-name="options" ng-reflect-model="0" ng-reflect-value="0" class="ng-untouched ng-valid ...

Selecting elements using XPath

My goal is to target an i element using the following XPath: //div[contains(text(), "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="32565356564153565341725e5d5d1c515d5f">[email protected]</a>")]//parent//i[contains(@c ...

Discovering xpath in Chrome Version 58.0.3029.81 (64-bit) can be done effortlessly with the help of xpathfinder. Unfortunately, the shortcut shift+ctrl+x

Having trouble locating the xpath in Google Chrome Version 58.0.3029.81 (64-bit) using xpathfinder. The shortcut shift+ctrl+x is not working for this. This xpath would be used with selenium 3.3.1 for automation testing. Your assistance is greatly appreci ...

Utilizing Selenium IDE and XPath to confirm that a checkbox is selected only when the associated label contains certain text

I need assistance in creating an Xpath query to validate if a specific checkbox is checked within the nested divs of the panel-body div. My goal is to ensure that a checkbox with the label "Evaluations" contains the class "checked". Below is the snippet of ...

What are the variances in using xpath with selenium webdriver?

WebElement element4=driver.findElement(By.xpath("/html/body/div/table/tbody/tr[2]/td[2]/div/div/div/div[4]/ul/li[3]/a")); WebElement element3=driver.findElement(By.xpath("//*[@id='nav_cat_3']")); When retrieving xpaths using firebug, both xpaths are bein ...

Select all elements in a column using Selenium in C# when two specific conditions are satisfied (Multiple Conditions)

My task is to extract all elements from the td of an HTML table. However, when I attempt to locate elements by xpath with multiple conditions, it fails and retrieves 0 elements. I have no issues retrieving all values with a single condition, indicating tha ...

Python Selenium Error - Message: Element not found: Element could not be located

Currently facing an issue while trying to extract data from a password-protected website using Selenium. The error occurs right at the login stage with the following message: NoSuchElementException: Message: no such element: Unable to locate element: {"met ...

Selenium: The art of pinpointing a specific node through precise text matching

When trying to find an Element on a Web Page using text, I am aware of the method called contains. For example: tr[contains(.,'hello')]/td However, the issue arises when there are two elements with names hello and hello1 as this function does not work ac ...

What is the process for creating an xpath for hyperlinks with the 'contains text' attribute?

I am in need of creating Xpath for links based on contained text. I have devised the following code to achieve this, however, a scenario arises when there are three links named 'Entity', 'Entity Type', and 'Entity Group'. If I click on 'Entity', the genera ...

When using Selenium WebDriver to locate an object, an error may occur stating that the result of the xpath expression is "[object Text]" instead of an element as expected

I am currently utilizing Selenium to validate the existence of specific text within a web page. Here is an example of how the HTML appears. <html> <div class="a-content"> <!--!-->==$0 " Text to Locate" <b ...

Having trouble finding elements with XPath in Python

While attempting to extract website information from firms listed on Bloomberg using XPath, I encountered a challenge as the results came back empty. After conducting multiple tests, it became evident that I was unable to locate any elements on the webpage ...

Assistance with PHP and XPath

Looking for assistance with using XPath in PHP. I am seeking guidance on accomplishing the following tasks within any given HTML content: Eliminate all tables and their contents Get rid of everything that comes after the first h1 tag Retain only paragra ...

What is the process for choosing a document from a Google Drive pop-up selection window using Python's selenium module?

Currently, I am working on a beta proof of concept automation project where my main focus is entering a Google Drive pop-up window and selecting a specific document to submit. The appearance of the popup window can be seen below: https://i.stack.imgur.com ...

Could not find an iframe element using the specified xpath

Every time I attempt to run the code below, I encounter an InvalidSelector exception: List<WebElement> allFrames = driver.findElements(By.xpath("//iframe")); org.openqa.selenium.InvalidSelectorException: Unable to find any element using the xpat ...

Finding checkboxes that have the "checked" attribute: a simple guide

I'm working with a list of checkboxes and trying to identify the ones that have the "checked" attribute. Here's an example of what my checkbox element looks like: <input type="checkbox" class="u-display--inline-block u-margin-right--small" checked=""&g ...

Locating an element in a table using the index number with XPath

Seeking an element's location in Python Selenium by its index number. This is the xpath for the specific element: /html/body/div[4]/div[1]/div[3]/div/div[2]/div/div/div/div/div/div/div[1]/div[2]/div/div/div/div[2]/div/div/div/div[2]/div/div[3]/div[1]/div/ ...

I encountered an issue with Robot framework where it was unable to retrieve the locator. Despite attempting to copy the xpath, I continued to receive the error message stating "unable to find the locator."

Here are the elements I am currently working on automating an application using Robot framework, Selenium in PyCharm tool. As part of this process, I attempted to define a keyword to click on a sidebar entity named "GCC Intelligence", but encountered the ...

Scrapy spider encountering issues during the crawling process

Having trouble crawling coupons on the Cuponation website. Whenever I try to run the crawler, it shows an error. Can someone please assist me? Thanks. import scrapy from scrapy.http import Request from scrapy.selector import HtmlXPathSelector from scrap ...

Having trouble locating the XPath for a button within a frame

My attempts to access the following website were unsuccessful: https://www.google.com/recaptcha/api2/demo I tried clicking on this button: https://i.stack.imgur.com/0q229.png Then, I attempted to click on this button: https://i.stack.imgur.com/LvTjG.pn ...

Guide: Interacting with the Sign up button on Spotify's registration page with Python Selenium

Having trouble clicking the "sign up" button on the Spotify registration page. I have located the xpath and css for the button but still can't click it. I even attempted to use "click text" but encountered the same issue. WebDriverWait(driver,10).until(E ...

Finding the initial channel points icon on twitch.tv/esl_csgo through Selenium and Python

While watching the livestream on the ESL CS:GO Twitch channel, I encountered an issue when trying to click on the channel points button/icon. Every time I attempt to do so, I receive an error message stating: "no such element: Unable to locate element." De ...

Looking for the submit button amongst the elements

I'm currently working on developing a Steam bot using Python that is intended to post within a Steam group. However, I am facing difficulties with the final phase as I am unable to locate the submit button. <button type="submit" class="btn_green_w ...

The choices can be found within the "_listener" attribute

Consider the following tag: <select class="xyz"_listener= "<select class="gwt-listbox"><option value="Select the option"></option> <option value="Name1"></option> <option value="Name2"></option> <option valu ...

Finding the precise XPath for a specific column title with C# and the Selenium WebDriver: A step-by-step guide

My dilemma is with the HTML snippet below, which I'm attempting to locate using XPath. Despite my efforts, the following code doesn't seem to be functioning as expected: <label class="ms-Label headerText-269" title="Reference Id ...

Finding the input box with C# Selenium: A step-by-step guide

Looking for the input box in this block of HTML: <div id="employeesDataTable_filter" class="dataTables_filter"> <label> <input type="search" class="form-control input-sm" placeholder="Filter..." aria-controls="employeesDataTable"> </l ...

YQL's xpath functionality is lacking in robustness

Before, I successfully used XPath with Python to extract data from a webpage but now I am trying to use YQL for the same webpage and finding it less reliable. The specific information I need to retrieve includes: 1. Last (AUD) 2. Close 3. Close (%) 4. Cum ...

Guide to creating a locator in Selenium Webdriver and Java to trigger a click on an image

I am trying to automate clicking on an image using an anchor tag in Selenium Webdriver with Java. <a title="Complete Step" class="tableIcon" href="javascript:__doPostBack('__Page','COMPLETEJS_2309234_2_2_0')"> <img title="Co ...

Finding the value within a div element with Selenium and Python

How can I extract the value inside a div using xpath or css_selector? This is the HTML markup: <div class="catalog-products view-tile" data-catalog-products="" data-slider-available="" data-primary-as-icon=""> ...

Navigating my path with precision using XPath

Currently, I am utilizing webdriver.find_element_by_link_text('searchterm') in Selenium to retrieve a webElement. Once obtained, I extract the value of href by using webElement.get_attribute('href'). Subsequently, I am able to pinpoint the element itself t ...

Selenium web scraping yielding different results than displayed on the user interface

Last week, User @KunduK was generous enough to assist me in scraping a website to retrieve the address of a specific record. The record in question can be found at this link: We used the following code snippet: address=WebDriverWait(driver,10).until(EC.vi ...

Error: The state of the element is invalid for importing a file

Currently, I am working on creating an automated test to import multiple files using the web application's UI. When the "Import" button is clicked, it launches Windows Explorer. The XPATH I'm using in my test is as follows: filename_field = //di ...

Having difficulty retrieving the city name from the website (goibibo.com)

New to using selenium, I am currently working on automating the website goibibo.com. My goal is to input "Chennai" into the "From" textbox using xpath, which prompts some suggestions. From those suggestions, I intend to select "Chennai". Utilizing Seleniu ...

I encountered an error when trying to locate an element using its class name and xpath in Selenium with Python. The error message displayed was `ERR_SSL_VERSION_OR_CIPHER_MISMATCH`

I am in need of gathering information from a specific webpage that cannot be referenced openly due to its adult content. In order to proceed further, I must first click the age confirmation button on the page. My sole interest is to retrieve the page's sou ...

Difficulty encountered with XPath when using specific ID

As a newcomer to Selenium, I am currently in the process of learning all aspects at once. Sometimes, I still face challenges in understanding HTML notation. Despite conducting thorough research on the internet and documentation, I have yet to achieve succ ...

Locate element by xpath in Python with the help of Selenium WebDriver

Is it possible to locate these elements using xpath? <a class="single_like_button btn3-wrap" onclick="openFbLWin_2224175();"> <span>&nbsp;</span><div class="btn3">Like</div></a> and <button value="1" class="_42 ...

Having trouble accessing an element that is not visible? One solution is to utilize Xpath in Selenium to input data into a

Currently, I am utilizing Selenium with C# to input data into textboxes on a webpage: Nevertheless, I keep encountering this issue: OpenQA.Selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with Despite ...

Guide to using Python and Selenium to extract the titles of each search result

I am currently learning Python and attempting to extract search results from python.org using the Selenium library. Here are the steps I want to follow: Open python.org Search for the term "array" (which will display the results) Paste the list of searc ...

A Step-by-Step Guide to Successfully Clicking on a Checkbox Using Selenium and Python

Hello everyone, I'm facing an issue with clicking a checkbox. Here is the code for the checkbox: <label class="has-checkbox terms"><input name="order[terms]" type="hidden" value="0" /><input class="checkbox" type="checkbox" value="1" na ...

Searching for the xpath of a parent div that is determined by various children divs

Imagine this example of html <div class="randomclass-parent" id="Need to find this div"> // The main div I am trying to locate <table class="rando table"> <tbody role="presentation"> <tr role=&q ...

Python code: Simulate clicking on the next page without a specified link to follow using JavaScript or AJAX

I'm seeking aid from a kind-hearted individual. I require assistance in navigating to the next page on this particular site: . Here's my code: from selenium import webdriver url = 'https://www.xtip.co.uk/en/today/index.html' browser = webdriver.Chrome(' ...

Tips on using selenium with python to interact with buttons

Starting out with Python and Selenium, I'm eager to automate clicking the "Afficher plus" button on this specific webpage. I attempted the following code snippet: plus = driver.find_element_by_css_selector("button[class='b-btn b- ghost']") plus.click() ...

Divergent behavior of Selenium xpath when used with python versus ruby

I'm currently facing an unusual problem with selenium. The following ruby code snippet: page.all(:xpath, "//table[3]//tr[last()]//td") Successfully retrieves all the cells of the last row from the third table on a webpage. In contrast, this python code ...

Mastering the art of extracting text values using Selenium webdriver

I am in need of crawling the DigiKey value for an electronic component. Currently, I can access the Supplier Info. using selenium and python, but I am encountering difficulty reading the text "Alpha & Omega Semiconductor Inc.". If anyone can assist me wi ...

What's causing the xpath's at thepiratebay3.org not to function properly?

Having trouble getting selenium to click on a link for me as it can't find any xpaths, and I'm unsure why Here's the code: from selenium.webdriver.support import expected_conditions as ec from selenium.webdriver.chrome.options import Options from selenium ...

Unable to locate specific text using XPATH contains and text() function

Here's a challenge - I'm attempting to come up with an XPATH that targets the list element containing the text "This Is The Text You're Looking For". Unfortunately, my current attempt using li//[contains(text(), 'This Is The Text You're Looking For')]

Are you getting an empty set with your Selenium XPATH query?

I recently checked out this website: After waiting for the page to load, I wrote the following python code: try: tmp = driver.find_elements(By.XPATH, '//*[text()="Login"]') print(tmp) except Exception as e: print('NONE ...

Steps to select an option from a drop-down menu that does not have an ID assigned

How can I interact with a drop-down element that appears after clicking on an item? <div class="field loan-selection"> <label class="field__body"> <div class="field__label">Nettokreditbetrag <!-- -->&nbs ...

Selenium IDE: Struggling to select a Vaadin button with click functionality

My goal is to automate the process of navigating to an external website by clicking on a button that shows the following week in a fullcalendar. I found a Fullcalendar addon for Vaadin that looks promising. The HTML code defining the button is as follows: ...

Managing duplicate xpaths in Selenium with Java

Seeking assistance with dynamically selecting items from a drop-down menu based on input. The challenge arises when values share the same name. For example, consider this Cucumber statement: When I go to the "Inventory" / "Inventory" application When ut ...

Could not find the button or link using any of the following methods: xpath, id, name, or css selector

Element not found using specified id, name, xpath or CSS selector Attempts were made with the following codes, but both failed to yield a response wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id=\'form\']/p/ ...

Selenium: Issue with clicking a custom popup button

Whenever I attempt to click on a button to select files and then submit in the popup, it does not recognize either the popup or the button within it. In order to select the modal-content driver.switchTo().frame("modal-content"); Here is the error messag ...

Is it Feasible to Use Accumulators in XPath with Python?

Is it feasible to perform an accumulation in XPath? Take a look at my code: driver = webdriver.Chrome() driver.get('http://www.imdb.com/user/ur33778891/watchlist?ref_=wt_nv_wl_all_0') wait = (WebDriverWait, 10) x = 1 while True: try: ...

Extract the HTML content from a website that is dynamically rendered using JavaScript

Follow this link to access a document in an open nutrition database: http://www.dabas.com/ProductSheet/Detail.ashx/124494 I am attempting to extract data from this page using xpath. The issue arises when I attempt to view the page source to identify the ...

Encountered an Xpath error while attempting to create a random email generator using Selenium IDE

While attempting to execute a script, I encountered an "element not found" error with Selenium failing to detect the xpath. My goal is to randomly generate email addresses. Every time there is an error message stating: [error] Element .//[@id='GmailAddres ...

Selenium in Python is having trouble locating an element using an absolute xpath that targets

After hours of research and browsing through numerous webpages and stackoverflow posts, I have managed to create a dynamic xPath for clicking on an element. However, despite my efforts, the click action is not working as intended... The main goal here is ...

Retrieve the occurrence of a specific element by its position using Xpath with Selenium, all while implementing a wait feature

When scraping a large static web page with Selenium, it's crucial to ensure that the entire page is fully loaded before attempting to scrape it. To achieve this, I have implemented a solution where I wait for the last <a> element to be loaded on the ...

Python Selenium: How to locate elements using xpath in the presence of duplicate elements within the HTML code

Currently, I am utilizing selenium to extract data from a liquor sales website to streamline the process of adding product information to a spreadsheet. My workflow involves logging into the website using selenium and searching for the specific product. Wh ...

Ways to choose a distant relative in XML using XPath

To target all direct <p>...</p> elements inside a div, the selector would be div/p If I wish to select all second-level nested <p>...</p> tags within a div, I could use div/*/p Can a specific range be specified instead? div/descen ...

Text successfully inserted into the input field using Xpath

I need help with the following issue: I am trying to use Selenium to verify if an input field contains a specific text that has been manually entered. Here is an example of an input field with the value '50': <input type="text" class="value ...

Element could not be located using the specified x-path

The HTML element code is: <html> < div class="view view-text" style="text-decoration: none; top: 9px; width: 216px; font-family: Kiro-webfont,Helvetica Neue,Arial; font-size: 20px; font-weight: bold; text-align: center; color: rgb(255, 255, 255) ...

Accessing interactive elements within an iframe when using Selenium

Is there a way to engage with the ddlDelegacion (dropdown menu) element on this webpage using Selenium WebDriver for Python? I need to periodically download updated documents from a government website for my family. The HTML code is provided below: <div ...

Tips for utilizing a CSS selector to find a single element with two attributes simultaneously in Selenium using Python

Currently, I am using Selenium Python Css selector to target 1 component with 2 attributes simultaneously, both of which should be partially matched. Successfully located the element with Xpath: fifth_item = driver.find_element_by_xpath("/html/body/div[c ...

Extracting content with Python and Selenium: A comprehensive guide

Regarding the following HTML: https://i.stack.imgur.com/7Jddo.png I am trying to use Selenium to select the paragraphs located on the left side of the screen. I attempted using class_name and id, but encountered a NoSuchElementException. Why is this erro ...

Element not found: Unable to locate the specified element with the CSS selector "#Password" while using Selenium with C#

I created a basic test for logging in. namespace Seleniumtest.Customer { [TestFixture] class LoginTestCase :TestBase { [Test] public void LoginWithPhoneNumber() { webDriver.Navigate().GoToUrl("https://te ...

Utilize XPath in Java and Selenium to locate a specific "text" element following another "text" element within an HTML document

Here is the HTML code snippet - <div><a href=""><span>Eligible ITC</span></a></div> <div><a href=""><span>(A) ITC Available</span></a> <div id="demo4a"> <table&g ...

Tips for grabbing the following element locator path with Selenium?

I am working on a piece of code to download a CSV file. Here is the code snippet: chromedriver = "/usr/lib/chromium-browser/chromedriver" driver = webdriver.Chrome(chromedriver) driver.get('https://www.aemo.com.au/Electricity/National-Electricity-Mar ...

Having trouble displaying text within a span element after using execute_script with Selenium?

After numerous attempts to insert text into an input box that functions as a span element, I decided to seek guidance on the proper approach. In my quest, I turned to utilizing the execute_script() method, but disappointingly, no progress was made. Below ...