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
-1 votes
1 answer
19 views

How to get the correct XPath for a column title using C# and selenium webdriver?

I have the following HTML <label class="ms-Label headerText-269" title="Reference Id">Reference Id</label> which I am trying to locate using XPath. I have written the ...
  • 101
2 votes
2 answers
36 views

How to find a specific occurrence of a field that exists in multiple places (Xpath)?

I'm new to Xpath and I wanted to know if there was a way to inspect a specific element, that is repeated multiple times throughout the webpage. For this instance I want to inspect the specific span ...
0 votes
0 answers
61 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"); ...
0 votes
0 answers
34 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='...
0 votes
1 answer
306 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=&...
0 votes
1 answer
554 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 = "...
-1 votes
1 answer
36 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?
0 votes
2 answers
43 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>
  • 1
0 votes
3 answers
1k 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 ...
  • 1
0 votes
1 answer
623 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=&...
0 votes
2 answers
81 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 it in a variable, but it always returns no such element exception. My xpath looks like below when ...
  • 107
0 votes
1 answer
302 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-...
0 votes
2 answers
53 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....
  • 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. ...
1 vote
2 answers
279 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 ...
  • 61
1 vote
3 answers
1k 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 ...
1 vote
1 answer
503 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 ...
  • 11
0 votes
1 answer
359 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....
-1 votes
1 answer
41 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 ...
0 votes
3 answers
753 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 ...
0 votes
2 answers
2k 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> ...
0 votes
2 answers
546 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.
  • 11
0 votes
2 answers
248 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(),'{...
0 votes
0 answers
70 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=&...
1 vote
2 answers
214 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,...
  • 11
0 votes
2 answers
493 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 ...
0 votes
3 answers
113 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]/...
  • 65
0 votes
0 answers
69 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 ...
0 votes
1 answer
1k 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, ...
  • 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 ...
-1 votes
1 answer
434 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 ...
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 ...
1 vote
1 answer
488 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 &...
  • 11
0 votes
1 answer
495 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 ...
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....
-2 votes
3 answers
50 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 ...
1 vote
1 answer
53 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]/...
2 votes
1 answer
407 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 &...
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&...
0 votes
1 answer
607 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: ...
  • 1
0 votes
1 answer
1k 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> &...
1 vote
4 answers
735 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:
0 votes
1 answer
1k 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 ...
2 votes
1 answer
817 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()....
2 votes
1 answer
191 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: ...
-1 votes
1 answer
68 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 ...
0 votes
1 answer
5k 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 ...
0 votes
1 answer
417 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 ...
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 ...
-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,...

1
2 3 4 5
7