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.

XPath (XML Path Language) is the result of an effort to provide a common syntax and semantics for functionality shared between XSL Transformations XSLT and XPointer.

The primary purpose of XPath is to address parts of an XML document. In support of this primary purpose, it also provides basic facilities for manipulation of strings, numbers and booleans. XPath uses a compact, non-XML syntax to facilitate use of XPath within URIs and XML attribute values. XPath operates on the abstract, logical structure of an XML document, rather than its surface syntax.

XPath gets its name from its use of a path notation as in URLs for navigating through the hierarchical structure of an XML document.

341 questions
5
votes
3 answers

Which Xpath is more suitable?

xpath 1 : //div[@class='abc'][.="xyz"]/parent::*/div[2]/div xpath 2 : //div[@class='abc'][.="xyz"]//following-sibling::div/div Above two xpaths are pointing same element. Which is better and why, Can anyone please describe ?
Gaurav
  • 327
  • 2
  • 3
  • 17
2
votes
0 answers

How to handle n number of dropdowns fields with same xpaths

I have two drop down fields that are parallel and there is a button as well from where more fields can be added at every row. There is no limit on the fields to be added and have to fetch values from the database with; separated. Xpaths are the same…
user41466
  • 21
  • 1
1
vote
1 answer

I can't find element in a HTML file with XPath

I am trying to get the name and the price information from this website with XPath. When i write my XPath expression down in the search bar it locates correctly in the chrome. But in VSC it doesn't work. I get nameHtml is null error. This is the…
1
vote
2 answers

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 checkbox that I would like to click is located…
Brian
  • 11
  • 3
1
vote
4 answers

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:
vinayak bahri
  • 21
  • 1
  • 3
1
vote
1 answer

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 can I get all checkboxes count under…
Ravi
  • 13
  • 3
1
vote
1 answer

Unable to get the element using the text containing line break

I need to get the span element by matching its entire text which has a line break. Below is sample HTML: I know we can use //span[contains(text(),'fourth')], but is…
Sandesh Sawant
  • 97
  • 2
  • 6
  • 15
1
vote
3 answers

Xpath returning 2 nodes. I am trying to return 1 node

I am using XPath to search the below web elements. My XPath command returns 2 nodes. I am trying to retrieve 1 node. Unfortunately, the web page I am testing has the exact same elements and text. Can you help? I am using ChroPath to test my XPath.…
joe john
  • 11
  • 4
0
votes
1 answer

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.Test; import…
user50114
  • 1
  • 1
0
votes
0 answers

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="pd-table"]//tbody//tr//td/text()').getall() I know…
0
votes
1 answer

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".

"Premium Volume - $"
"Policy Count - 0"

How do I do that?
user45674
  • 19
  • 1
  • 1
0
votes
1 answer

How do I find xpath for "Invalid License!" text in the HTML code shown

0
votes
2 answers

How do I use XPath to find the values of cells in a table

The structure of the Html I need to work with is shown in the screenshots below. I need to get the values of the first and third column of each data row in the table. There is nothing unique about the rows or cells. I've tried: //String…
0
votes
3 answers

Regarding taking Xpath

Kindly follow the below HTML code. I want to get the text "DefaultBP" in between the tag. If I using this XPath "//div[@class='workspace']//h1", all the texts including tag such as "Export", "Import", "Tariff List" & "Add Prefix" are displayed. I…
Jency
  • 1
  • 1
0
votes
1 answer

Xpath worked during script creation not working when replaying

HTML Tag: 100% Profile Strength Update your profile Earlier when I created the script, it did…
1
2