Questions tagged [xpath]

The primary purpose of XPath is to address parts of an XML document. 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.

-1
votes
2answers
28 views

Xpath for div with span having a css class get its sibling anchor link

I want all div's anchor link whose span having css class ='block-diff-neutral' <div class="file-info" xpath="1"> <span class="diffstat tooltipped tooltipped-e" aria-label="0 "> ...
0
votes
1answer
23 views

How to sorting parent elements only by their root nodes in XSLT?

I got a XML file looks like <root> <number>1</number> <number> <deleted>0</deleted> 3 </number> <number>2</number> </root> I want ...
0
votes
1answer
13 views

Is it possible to evaluate a “complex” xpath expression stored in a variable using xquery (BaseX)?

I'm trying to do something like this in xquery (working with basex) let $node := doc('doc.xml')//*:root let $xpath := "descendant::*:path/*:to/*:node" let $val := $node//$xpath It is possible with ...
0
votes
0answers
14 views

XPath selector working on chrome dev tool but not with php domXpath why is it

Trying to scrape a page using xpath and php domxpath, the xpath expression is pulling data in chrome dev tool, but it returns empty result on php code, Here is the sample page $dom = new ...
2
votes
3answers
43 views

Finding elment in Selenium using XPath

What is the difference between ".//", "//","./" and "/" in XPath while finding element in Selenium? Describe.
0
votes
1answer
59 views

Find by Id two elements with Javascript

I have the 2 Xpath below that don't have Id nor class. I want to find the element with "id=RTY_183" or "id=RTY_189". //*[@id='RTY_183'] //*[@id='RTY_189'] I've tried regex and or but don't work, ...
0
votes
1answer
34 views

Creating a JSON from xml with date and time logic templates

I'm trying to create a JSON from a XML which has messages and each message has its date/time. Below is the XML <message> <messageText heading="Temporary Maintenance Message 1">...
-1
votes
0answers
3 views

Selector from website from Google spreadsheets

I want to extract the data of certain products from below websites using google spreadsheets. How to do it? I want product name, link and picture https://www.czajna.pl/ https://www.Wykop.pl/
0
votes
1answer
26 views

Selenium find_elements_ from a tag (xpath or css)

I want to scrape prices with Selenium (Python) from a website (i am a beginner). I recognized that the price is not always in the same html tags and those are the following tags in which is the price ...
0
votes
0answers
22 views

I am trying to fill in a login automatically but keep getting NoSuchElementException

I am trying to log in for testing to https://betwarrior.bet/en/login but keep getting no such element exceptions for the email section... I have tried with absolute xpath but no luck. from selenium ...
-2
votes
0answers
15 views

Dynamic xpath for dynamic elements [on hold]

Want xpath for below code Question :- Request you to help create xpath using 11:58 however time 11:58 is dynamic value <div class="row ChartVersionMain"> <a style="color:gray" ...
0
votes
2answers
23 views

How to get value from Key value inside nested element of XML

Please view my XML <?xml version="1.0" encoding="utf-8"?><d:query xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/...
1
vote
1answer
26 views

Trying to select slippery href attribute with xpath in c#

Trying to scrape a .pdf from a site but the XPath is being stubborn. Site I'm trying to get the .pdf from xpath given by inspect > copy > copy xpath: //*[@id="content"]/div/table[2]/tbody/tr[0]/td[...
0
votes
0answers
17 views

Matching an array/list of values in xpath expression

I am looking to match a list/array of values in my xpath expression and would like to know if that's possible. My XML <Parent-tag> <Child-Tag> <status>Up</...
0
votes
1answer
30 views

Extract date from text inside html tags using XPATH

Extract date inside html tag using xpath substring I have tried using substring in xpath <span id="latestReplyLine"><a href="#comment-965609" class="lastScroll js-latest-reply">Latest ...
0
votes
1answer
17 views

How to extract paragraph values in html when having multiple <p>?

I need to extract address, telephone using xPath from my html page. My html code is: <div class="info-block-value"> ==$0 <p>36 rue de la Verrerie 75004 PARIS</p> <p>Tél :...
0
votes
2answers
27 views

xPath doesn't go on to the next page

When I use below code, the website doesn't go on to the next page. import unittest from selenium import webdriver import time class ProductPurchase(unittest.TestCase): """ Purchase the ...
1
vote
1answer
24 views

Variable within XPath Expression

I am having difficulties placing a variable within my XPath expression. I want to make a search term that I can modify from an input, and use it in the XPath expression, but the second example below ...
0
votes
1answer
25 views

Selenium WebDriver to match similar xpaths

I have following xpaths, which should be handled on same way by WebDriver, I need to get text content from these. //*[@id="dialogMessage"]/div[3] //*[@id="dialogMessage"]/div[3]/p //*[@id="...
0
votes
2answers
55 views

.Net standard library that supports XPath 3.1

I'm maintaining a legacy tool of the company I work for written in C# and I'm converting it to .Net standard 2.0. It uses the Saxon-HE processor to process some XPaths and replace some configurations ...
0
votes
4answers
33 views

Unable to access img within Div with BeautifulSoup

I'm trying to access the SRC of an image using BeautifulSoup in Python. Here's the way the image is nested: <div class="artistAndEventInfo-7c13900b"> <a class="artistAndEventInfo-...
2
votes
3answers
35 views

MarkLogic XPath on JSON with “@” symbol in property name

I am dealing with some JSON-LD data in MarkLogic and have trouble using XPath on property names with "@" symbol. For example: { "@type": "News", "title": "some title", "description": "some ...
1
vote
1answer
35 views

get html attribute value which attribute name include colon with xpath expression

I'm using scrapy with selenium I have this html input element: <input class="anniucssC" type="button" value="当页累计" v:click="doThisPageTtl()"> <input class="anniucssC" type="button" value="...
0
votes
1answer
26 views

Getting Empty Result from Web Scrape Using XPath

I amusing the following code to scrape the ticket price from the "Cheapest" tab. However I just get "[]" as a result. Can someone verify my code and XPath are correct? I have tried using both the ...
1
vote
1answer
35 views

Is there a way using lxml.etree to skip the first entry or start the iteration at a specific child when parsing an XML file?

I am currently using the .iter method in the xlml.etree package for Python to parse an XML file. Is there a way to skip the first entry or start the iteration at a specific child using something like ...
0
votes
0answers
32 views

Ansible XML Module adding nested children

I'm setting up a ansible project for an aws infrastructure and need to edit multiple XML files, mostly adding nested elements. After some time I got an example running which was harder then I expected....
0
votes
0answers
13 views

Select child of element if exists, else take parent

I want to catch the error message text from within a <span> tag, or if it does not exist, from its parent, a div tag. For this I need a valid xpath expression that can handle both cases as one ...
0
votes
1answer
20 views

XPath: Using string functions on a node-set?

I am wondering if it is possible to use string functions on a node-set - specifically the 'substring()' function in XPath 1.0. The page I am scraping details from has a node-set of 5 URLs that are ...
1
vote
1answer
25 views

I cannot parse in python multiple xml files

i am trying to get data from xml files, using 1 xml file my code works and i have all the data that i need, but when i try to get my code work using diferrents xml files it fails, all the xml have the ...
0
votes
2answers
68 views

Can someone help me with one more relative XPath to find an element?

Sorry to ask again. I have one more webElement I can't locate on an Angular grid. I can get the XPath but it's very long and I need to condense it. FULL HTML and my XPath are below. I need to find ...
0
votes
1answer
41 views

selenium - create xpath with span text which contains sup tag

Here is the HTML block from my code <a href="#link" class='megamenu'> <span> "String1" <sup>®</sup>> "String2" </span> </a> I want to create xpath which ...
0
votes
1answer
28 views

How to create a relative path for this HTML element in selenium?

I have an HTML element I am trying to click on, in an Angular grid. When I use Developer Tools to copy the XPath I end up with a massively long XPath. This does work, however I would like to make it a ...
0
votes
2answers
64 views

How can I identify an element that resides in an iframe without using an absolute xpath?

I'm writing a Selenium Script to check the number of rows in a page : The rows are in an iframe so I couldn't not use /*[starts-with(@id, 'someid') to find number of elements as selenium webdriver ...
1
vote
2answers
27 views

How can I get the value of the specific value in the xml file?

I keep getting no result, even when using local-name() to retrieve an xml value. I'm working with NiFi (apache 1.9.2) and having what I think is probably a problem with namespaces. I have an XML file ...
0
votes
2answers
31 views

Identifying an element from a group, span[i] is the differentiating factor

I have added the screenshot I have a group of elements that have the exact same xpath except the span tag.I want to identify the individual input fields, but unable to. I have tried using contains, ...
0
votes
0answers
14 views

How to get an attribute's value

I trying to check the specific value in some of the XML files in my folder. 1) In my folder I have couple of files which I sorted out using Directory.GetFiles(jobpath).Where(x=> !x.Contains("Default")...
0
votes
0answers
32 views

Trouble extracting text content from XPath expression

I am trying to extract text content from a XPath expression using the following code: page = requests.get('https://www.momondo.com/flight-search/PHL-VCE/2019-06-19-flexible/2019-06-25-flexible?sort=...
2
votes
1answer
31 views

SQL Xml for Xpath query

Trying to return the value of an XML field via Xpath query. Here is what the XML looks like in a snap shot. <?xml version="1.0" encoding="utf-16"?> <ArrayOfCustomProperty xmlns:xsi="http:/...
0
votes
1answer
16 views

Convert to Requests from Selenium Find Element by XPath

I was using Selenium Webdriver to extract a price from a website using "Find Element by XPath" and then converting it to text. Now I need to switch to using Requests, instead of Selenium, and it seems ...
0
votes
2answers
20 views

How can I obtain the whole min attribute with XPath?

I want to obtain an attribute using XPath. <?xml version="1.0"?> <GetTest> <Result> <id>10</id> <name>ABC</name> </Result> <Result> <id>1&...
1
vote
1answer
18 views

How to select content of H3 if H2 contains certain text

I would like to scrape the content of the H3 element if the H2 just above it contains a certain text, in this case the H2 should contain "Course advanced Sydney". But I can't get the Xpath to work. ...
2
votes
1answer
13 views

XPATH sum function

Is there a way to use the sum function in XPATH, so it will work on sub-nodes in the XML file? Given the following XML file. <?xml version='1.0' encoding='UTF-8'?> <countries> <...
0
votes
1answer
37 views

Select all groups of elements placed immediately after another using xpath expression

I have this html <div class="A"> A </div> <div class="B"> 1 </div> <div class="B"> 2 </div> <div class="B"> 3 </div> <div class="A"> A </div&...
0
votes
0answers
21 views

Need some help to implement a XPATH expression

I do have an XML document of the following format. <root> <element> <element1>value1</element1> <element2>value2</element2> <...
0
votes
1answer
24 views

search (Xpath) then clicking ABOVE and NEXT cell

I had to find some style using Xpath then i had to click above line with different cell (different tr, different td) <tbody> <tr> <td>Random Number</td> <td><...
0
votes
1answer
16 views

Bookmarklet to open new tab with Xpath from current page as URL arguments

I would like to create a bookmarklet that can use 3 Xpath from the current page to build a Url with the xpath as the arguments. I have tried to find an existing bookmarklet that was similar that I ...
2
votes
1answer
26 views

selenium webdriver: list all elements of “input” drop down and select a different element

With python3 selenium chromedriver, on this URL: https://www2.sgx.com/derivatives/products/chinaa50 How can I get the list of Contract Months. From Chrome F12, it appears this is the corresponding ...
0
votes
3answers
30 views

how to match text in a div element using xpath?

I am trying to locate an xml element in selenium using xpath. It is nested in inside . I have numbers 3498546 and 3498755 in hand. I need to match these numbers to the numbers listed in elements ...
0
votes
1answer
13 views

Sitecore Content Editor generates Random GUI element properties or which are not unique on webpage like xPath, ID or Class

While automating Sitecore Content editor (backend) i have come across one problem that, while adding the same component, values of element ID's and xPath changes. Elements like add here or approve ...
0
votes
2answers
16 views

How write an XPath expression for a list of objects?

I'm trying to write XPath expression to search in XML like this: <?xml version="1.0"?> <GetTest> <Result> <name>ABC</name> </Result> <Result> <name>DEF&...