Questions tagged [xpath]

XPath (XML Path Language) is language for addressing parts of an XML document, designed to be used by both XSLT and XPointer. It also provides basic facilities for manipulation of strings, numbers and booleans. XPath uses a compact, non-XML syntax. XPath operates on the abstract, logical structure of an XML document, rather than its surface syntax.

Filter by
Sorted by
Tagged with
0 votes
0 answers
12 views

Making Webpage headless is causing issue with finding WebElement through Xpath

I had to make chrome browser headless after which when I try to see the html code by executing below lines ChromeOptions options = new ChromeOptions(); options.addArguments("--headless"); ...
user avatar
0 votes
0 answers
9 views

Unable to click anchor tag in grid again after navigating to another page

In the gridview I click the anchor tag in column KU_Total Qty following which I navigate to Grid in another page. WebElement totalQty = ldriver.findElement(By.xpath("//td[@aria-describedby='...
user avatar
0 votes
1 answer
37 views

Problem finding element with text when the text contains &nbsb;

I have the following element in the DOM: <div id="sourceListDiv"> <select id="sourceList" onkeydown="uil.handleKeyDown(this)" size="15" ondblclick=&...
user avatar
0 votes
1 answer
102 views

Xpath to an anchor returning error: unable to locate element

I am new to automated testing. I am using C#, Selenium and Chrome 99 with the correct driver. I am trying to get to an anchor tag on the page. Here is my code that is not working, driver.Url = "...
user avatar
-1 votes
1 answer
27 views

I want to select a checkbox, how to obtain a xpath for the picture below anyone?

Please help me with the xpath for the above picture to select a checkbox?
user avatar
0 votes
2 answers
33 views

How to find xpath of "BBB element in following example?

I am unable to find xpath of "BBB" in following span class example. <span class="xyz"> "AAA" "BBB" "CCC" ==$0 </span>
user avatar
  • 1
0 votes
3 answers
427 views

Selenium - How to remove &nbsp from my text value

I am trying to use this xpath to find the number of elements that have a value between X and Y. The problem I am facing is since there is &nbsp in the HTML, and the code doesn't detect the text ...
user avatar
  • 1
0 votes
1 answer
192 views

Selenium - cannot click on radio button

I have tried all the possibilities but am unable to click the radio button Yes or No. It would be great if I get some help. I have observed that Need to take this attribute (<span radiogroup class=&...
user avatar
0 votes
0 answers
36 views

Unable to capture the element using xpath

I'm trying to capture the dynamic code using xpath(Selenium+Java). I want to get that code and store. but it is capturing and always gives no such element exception.my xpath looks like below when ...
user avatar
  • 97
0 votes
1 answer
118 views

How to write xpath or css for background-image value

I wanted to write Xpath or css for <div class="img"style="background-image:url(//cdn.shopify.com/shopifycloud/shopify/assets/no-image-2048-...
user avatar
0 votes
2 answers
50 views

What was your most annoying website you have ever found when creating dynamic Xpaths

When interviewing a candidate for QA automation positions, I used to give a website URL and ask them to create a dynamic XPath for a given element. It's mostly on https://opensource-demo.orangehrmlive....
user avatar
  • 2,093
-1 votes
2 answers
23 views

xpath find the right number

When I right-click and copy XPath this is what I get //*[@id="AssetPreview_0"]/div[7]/div/div[1] The information I want to gather is 119 this is the price of the asset I want to buy. ...
user avatar
1 vote
2 answers
111 views

On selecting the radio button how to get the text of the selected radio button where the text is in the next column

On selecting the radio button how to get the text of the selected radio button where the text is in the next column I randomly select the radio button and then i need to Store the selected Radio ...
user avatar
  • 61
1 vote
2 answers
440 views

Selenium is not finding button even though it has a Class Name and XPath

I am attempting to click a save button but Selenium (with Python) is having issues. I keep getting the error, "Message: no such element: Unable to locate element" Here is the HTML <input ...
user avatar
1 vote
1 answer
247 views

XPath 'list' object has no attribute 'click'

I'm trying to select a checkbox on the following public web-page using Selenium XPath from Python and click it to change the checked status. http://simbad.u-strasbg.fr/simbad/sim-fout For example, the ...
user avatar
  • 11
0 votes
1 answer
170 views

Unable to find XPath for mouse hover

I can't find my XPath so that I can't run the code. Can anyone solve this issue? I have to do mouse hover manage content then click on content Library: package TestNG; import org.testng.annotations....
user avatar
-1 votes
1 answer
39 views

Not able to click() on newly added account number from a account list on the page

A new account is created using selenium script and a message appears that "Account is created successfully : <***12345>" After this, Account page is displayed where all the accounts ...
user avatar
0 votes
3 answers
500 views

How to pass text dynamically in xpath under Properties file

I am stuck in a situation where I want to write Xpath dynamically in the properties file. The actual XPath is like in property File div[contains(text(),'<state Name>')]. State Name changes ...
user avatar
0 votes
2 answers
1k views

Finding sibling of found element using selenium

I've got a field with a date in it that's identified by a code that's shown in the div previous to it. <div class="fcode"> <div class="fcode_n">(123)</div> ...
user avatar
0 votes
2 answers
330 views

The relative xpath for the 2nd button of two identical buttons - selenium

i need to identify the relative xpath for the 2nd button highlighted in the image Can someone help me //*contains(@class,'fa fa-clock-o') I used this. It identifies the first button again.
user avatar
  • 11
0 votes
2 answers
189 views

I have a dynamic xpath which is based on 4 values, if I am using OR condition the xpath looks huge, any other way to handle this?

_OPTION_1 = "Average" _OPTION_2 = "M" _OPTION_3 = "Casual" _OPTION_4 = "D" _WIDTH_VALUE_XPATH = f"//mat-option/span[contains(text(),'{...
user avatar
0 votes
0 answers
46 views

How to ignore unnecessary attributes in my response.xpath?

I am trying to scrape some data with scrapy using xpath selectors and i would like to get rid of the unnecessary data, the xpath selector is the following: values = response.xpath ('//table[@class=&...
user avatar
1 vote
2 answers
151 views

Cannot select html td link button by XPath with Webdriver

Here is my element <td> <div class="linkButton" onclick="window.open('../../Report/Reports/ViewReport.aspx?reportName=Revenue.Report','Report1','scrollbars=1,resizable=yes,...
user avatar
  • 11
0 votes
2 answers
93 views

Extract InnerHTML from

Is there a way that I can extract the following data in Chrome Devtools Console. Currently I do the following in the console of the chrome devtool: $x("//a") I get a list with all the a ...
user avatar
0 votes
3 answers
102 views

Issues creating custom xpaths

I've became lost in the world of xpaths, so got an advice to create custom xpath, instead of coping this one, for example "/html/body/div[1]/div[4]/div[1]/div[7]/div/div[2]/div[3]/div/form/div[2]/...
user avatar
  • 65
0 votes
0 answers
52 views

How to choose a result in a dynamic webtable that has the same name and later timing in Selenium Python?

I have been working on a Selenium project in Python where I want to choose the result which has a later timing than the earlier one but have trouble implementing it. What I meant is this, Example if ...
user avatar
0 votes
1 answer
931 views

How to find all child elements inside a WebElement or List of WebElements in Selenium?

I have a <section> tag in which there is <tfoot> tags and many <td> tags. I want to store the 1st & 4th td elements of a in a Map, but i get index out of bounds exception. Now, ...
user avatar
  • 1
2 votes
1 answer
2k views

locating element with one class out of multiple classes inside a div using xpath in selenium

I have below two input fields and I have to find there location I can't use class selector cause iI have to identify element based on formcontrolname and ng-invalid class <div> <input ...
user avatar
-1 votes
1 answer
116 views

Understand How to Click on an a Table Element (URL) Based on a Value in that Same Row Using Selenium [closed]

I am automating steps in a browser using Selenium/Python; however, I am stuck with trying to understand how to get Selenium to recognize a text value in a table and click on the URL in the ...
user avatar
1 vote
1 answer
2k views

RobotFramework: Link/List with locator not found

I am studying Robot Framework with Selenium Library and I can't figure out how to remove "kw" element from the next dropdown: I tried to use xpath for it: *** Settings *** Library ...
user avatar
1 vote
1 answer
466 views

Automating a comment delete on FB with Selenium

I am trying to automate deleting my old comments on posts I've made on FB. Im using Selenium with python to achieve this. I am currently having trouble dealing with pressing the hidden buttons (1 &...
user avatar
  • 11
0 votes
1 answer
415 views

Selenium C# Locate Both Data QA Attribute And CSS Class

How do we locate both Data QA Id and CSS Class using Selenium C# ? We're trying to locate both a DataQAid attribute and also see if its class ng-invalid, (Angular Material Textbox Error) This is what ...
user avatar
0 votes
1 answer
2k views

Unable to fill the card details for Payments using Selenium at the merchant's checkout page

I have just started learning Selenium web automation tool and wanted to auto-fill the card details on the merchant's Payment Page but unable to do so using Selenium. Below are the things which I tried....
user avatar
-2 votes
3 answers
49 views

XPATH clarification [closed]

Refer: Picture of elements of HTML screenshot I am trying to get XPATH //*[@id="pg:pbEdit:conlist"] or //select[@id="pg:pbEdit:conlist"] Works but I want to be precise not ...
user avatar
1 vote
1 answer
51 views

Variable in Xpath is not working

#driver.find_element_by_xpath('//div[@id="groups"]/div/div/div/div/div[2]/div[1]/div/div/button').click() i = 5 gPath1 = str("\'//div[@id=\"groups\"]/div/div/div/div/div[2]/...
user avatar
2 votes
1 answer
370 views

Using loop how to get dataframe from each next pages and store table values using Selenium Python

https://seffaflik.epias.com.tr/transparency/tuketim/gerceklesen-tuketim/gercek-zamanli-tuketim.xhtml from the above website, I've achieved to enter date picker for two date range and then clicking &...
user avatar
0 votes
1 answer
34 views

How do I write a better xpath of this element? [duplicate]

I am working on a project and building automation test suite for a webpage. A certain part of the webpage looks like this. The corresponding HTML is as follows: <p class="customer-service&...
user avatar
0 votes
1 answer
430 views

I want to enter text in search text box and click search icon or enter [duplicate]

I am facing the issue . Kindly assist. The HTML Code snippet is attached I am getting the error as Exception in thread "main" org.openqa.selenium.NoSuchElementException: no such element: ...
user avatar
  • 1
0 votes
1 answer
764 views

Finding a xpath for text which is followed by break tag

I have below HTML code, in that I have to come up with XPath for the 2nd line of text: "Policy Count - 0". <h2 id ="lblpremiumVol"> "Premium Volume - $" <br> &...
user avatar
1 vote
4 answers
411 views

How to write the xpath for an element preceded by another element?

I want to get the value from an element based on the element preceding it. For example, getting the value "YYYY-MM-DD" based on the element "date" Here is the html snippet:
user avatar
0 votes
1 answer
940 views

Error: Exception in thread "main" java.lang.NumberFormatException: For input string: ""

Scenario: I am using Selenium Java. I need to add items to the cart and calculate the total price of the items in the cart. Url: https://rahulshettyacademy.com/seleniumPractise/#/ Issue: My code is ...
user avatar
2 votes
1 answer
607 views

The instruction (Keys.ARROW_DOWN) is moving the cursor to the bottom of the dropdown list instead of the first option

Scenario: To search and select the first destination location that matches the input string using the below code. Code snippet: driver = new ChromeDriver(); driver.manage().timeouts()....
user avatar
2 votes
1 answer
139 views

The value from the table is different using Xpath and CSS selectors

Test url=https://www.cricbuzz.com/live-cricket-scorecard/22585/aus-vs-nz-1st-odi-new-zealand-tour-of-australia-2020 I am trying to get the title of a table using the below code: Code snippet: ...
user avatar
-1 votes
1 answer
45 views

How to get "10:20 AM IST" from that code using xpath in selenium

<div class="game-date-time"> <span data-date="2017-03-11T04:50Z" data-behavior="date_time"> <span class="time game-time" data-dateformat="time1" data-showtimezone="true">10:20 AM ...
user avatar
0 votes
1 answer
4k views

Problem with finding element with Selenium and Xpath

I have a problem that is very strange for me because the code that I wrote, I am quite sure should work! Config Details Chrome version: 80.0.3987.132 ChromeDrivers version: same as ...
user avatar
0 votes
1 answer
380 views

No Such Element (Selenium) [duplicate]

I have checked far and wide for a fix for this. But to no avail. Nothing seems to work. I am trying to locate a Username and Password box to enter in the information. But it comes up with the error ...
user avatar
1 vote
5 answers
1k views

Element not found in a runtime

I am encountering a very unusual thing, the one I haven't seen before. There is one element I needed to find for testing purposes, it is visible on the page and I can find its unique relative XPath ...
user avatar
-1 votes
3 answers
1k views

Retrieving an XPath Text from a Web Element [closed]

I have a task where I need to retrieve the following text in black color highlighted in yellow. It is not within any tags and has no attribute. Once you locate a web element through the Inspect option,...
user avatar
1 vote
1 answer
116 views

How to get xpath of only the categories for checkboxes

I am trying to find the xpath / count for all the checkboxes under "Categories". but when I am trying to get xpath/count it is getting me all the checkboxes under "Categories" and under "Brands" How ...
user avatar
  • 13
0 votes
4 answers
892 views

Not able to find the unique xpath for an element in expedia.com using Selenium

I am trying to find the unique xpath for elements in the "travelers" pop option in the home page of expedia.com When I give the following xpath "//div[contains(@class,'gcw-menu')]/div/div1/div2/div[4]...
user avatar

1
2 3 4 5
7