Most voted "xpath" questions
It is a query language for XML. Using Xpath, the programmer can locate and query existing nodes in an XML document. When asking a question with this tag, it is critical that you provide a minimal, complete and verifiable example of XML and attempted solution that DOES NOT RELY ON EXTERNAL LINKS.
Learn more…58 questions
Sort by count of
-
17
votes2
answers2317
viewsWhat is Xpath and what is it for?
Opening Developer Tools in Chrome to copy HTML from an element <div id="teste">, saw that there is an option "copy Xpath" as shown below: When choosing this option, it sends the following to…
-
14
votes2
answers1293
viewsXpath with Python
I have the following XML (simplified): <produto refid="cat01" idprod="tv01"> <marca>xxx</marca> <modelo>xxxx</modelo> <genero>xxx</genero> </produto>…
-
4
votes2
answers2038
views -
4
votes1
answer251
viewsReturn multiple attributes using XPATH
How can I return multiple attributes using the xpath language? For example this xml: <utilizador> <nome>Rui</nome> <contacto>91xxxxxxx</contacto>…
-
4
votes1
answer129
viewsHow the XPATH contains function works
I have a xml thus: <?xml version="1.0" encoding="UTF-8" ?> <A x1="ab"> <B x1="abb"> <C x1="cc"> Marta </C> <B/> <B x1="be"> <C x1="be"> João…
-
3
votes1
answer151
viewsSerialize XML and save to Oracle with C# and ADO
I wonder if there is something equivalent in Oracle for this select in SQL Server: select NickName, ExternalId1 from Basics where externalId1 = @externalId1 for xml auto, elements; And to this…
-
3
votes1
answer720
viewsIdentify elements with xPath
I wanted to identify the following element on a page: <input name="ctl00$ContentPlaceHolder1$txtData" type="text" value="19/01/2015" id="ctl00_ContentPlaceHolder1_txtData"…
xpathasked 9 years, 11 months ago Rodolfo Oliveira 917 -
3
votes4
answers1398
viewsTool to generate Xpath
Hello, I’m making a Spider to capture with Xpath some web data. But the creation of xpath is a bit laborious. Does anyone know any way to train Xpath? Example; I click 5 times on a link and some…
-
3
votes2
answers726
viewsDomxpath query with multiple classes
I’m performing a parse on a file html with the following structure : <div class="lstImv blackBd12"> <div class="stCl3 stLeft imvImg"> <div class="imgBox"> <a…
-
3
votes1
answer98
viewsQuery problems on Xpath
HTML: <div align="center"><center> <table border="0" cellpadding="0"> <tr> <td bgcolor="#006090" valign="top" align="center"><p…
-
3
votes1
answer124
viewsHow to do an Xpath expression in an XML with multiple namespaces?
I have the following xml: <root xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <body xmlns="http://www.foo.com/bar"> <checkCredit> <CheckCreditOut> <nomeSerasa />…
-
2
votes2
answers899
views -
2
votes2
answers1632
viewsHow to get the <a> tag inside a <DIV, using XPATH?
I’m trying to get the data from a DIV that contains the following structure: <div class="item" style="height:273px"> <a href="/arapiraca/anuncios/detalhes/159695-honda-cg-150-2008">…
-
2
votes1
answer102
viewsAccess certain line of the variable
A while ago I asked a question about regular expressions and a user answered me using this code, using xpath: $dom = new DomDocument;…
-
2
votes2
answers330
viewsCapture and decrease values of multiple Ivs and inputs
I got it with the help of @Qmechanic73 , make a parser on a remote site, and capture the values between the tags span that is within several div with his determined id, and the span with their class…
-
2
votes1
answer75
viewsProblems with restrict_xpaths parameter in a Crawler
I have no Python experience, but I decided to try to do something with Scrapy for testing. So I’m trying to collect the existing articles on a particular page, namely a DIV element with an ID…
-
2
votes1
answer81
viewsXpath does not recognize XML elements
I have an XML. But something is happening that I don’t understand. When trying to use Xpath to return the Author elements, using //Author (tested pathway…
-
2
votes1
answer67
viewsIs it possible to get the value of the background-image attribute through xpath?
I have the following structure: <div class="xGh" style="background-image: url('name_file.jpg');"></div> Where I need to capture: name_file.jpg I tried to use the solution presented in…
-
1
votes1
answer319
viewsHow to make a query inside an XML file?
I need the value of <version> is returned to a variable in a WPF application. The XML file is on the server and contains: <?xml version="1.0" encoding="ISO-8859-1" ?> <Application>…
-
1
votes0
answers76
viewsXpath to collect data
I’m developing a bot to capture certain information from websites, but when I try to collect the information related to the description of the item collected, it does not go through the while…
xpathasked 6 years, 8 months ago Jonathan Igor Bockorny Pereira 111 -
1
votes0
answers77
viewsCompare childnode with C# and XML variable (Xpath)
I have an xml file with several structures. I have a structure called Product who has a field ProductCode and I have a structure called SalesInvoice, inside of it I have a field Invoice, within the…
-
1
votes1
answer1296
views -
1
votes0
answers194
viewsCapture child attribute value using xpath
With xpath I want to get the value of the attribute of href below, however I need to make sure that will be the url present inside the tag li. <li class="event"> <span…
-
1
votes1
answer68
viewsRetrieve data from an XML file using Xpath and C#
I have the following document XML, and I intend to do a search/filter by name Givenname using Xpath. How to do? XML <bloodonors> <donor> <Number>1</Number>…
-
1
votes2
answers508
viewsHow to select an element that depends on another by Xpath
I need to build a xpath that returns the Meu elemento only if the Dependenciais present on the screen. I am currently making the filter of Meu elemento using the section below:…
xpathasked 7 years, 1 month ago user34594 -
1
votes1
answer49
viewsI can’t get xpath from comment box on Youtube
I need to be able to comment on Youtube, but XPATH does not work, even with the right parameters, I tried with ID and ELEMENT but I was not successful. from selenium import webdriver import keyboard…
-
1
votes1
answer769
viewsXpath with Python - Pick up text after tag in a div
I’m trying to get a text after a tag that’s inside a div, in an html. The problem I’m having is that I’m not getting the text, just an empty string. I’ve looked elsewhere and I haven’t seen anyone…
-
1
votes1
answer95
viewsStore return of XML
I have a return of an XML that is a loop (because it’s the only way I know how to call back) but in XML I have two det, det nItem="1" and det nItem="2" which are 2 products, inside them is the tag…
-
1
votes1
answer586
viewsHow to press the Instagram follow button? with python
I’m trying to create a robot to follow people on Instagram, but I saved on the most important part, to click to follow the person. I’m using the python language and the Selenium, gnt I’ve put from…
-
1
votes0
answers24
viewsSelect text from a div and ignore any other tag using Xpath
I have the following situation where I want to get the text from a div and ignore the contents of the daughters Divs and get only the text from the parent div below follows the html structure.…
-
1
votes0
answers32
viewsscrapay+xpath returning empty array
I’m learning how to create a Crawler with scrapy + xpath. However, when I give the command scrapy shell https://br.udacity.com/courses/all/ The system returns this as if everything is normal:…
-
0
votes1
answer182
viewsString is not a Valid Xpath Expression - Selenium Webdriver
Hello, I am using the following expression in xpath, but invalid xpath syntax error occurs. When I inspect the element in Mozilla’s firepath, it recognizes, but when running the test it fails.…
-
0
votes0
answers24
viewsVariable xpath saved in Mongo
I have tried it in many ways, but I believe I am missing the point. I would like to save XPATH on Mongodb and import it into item() of Function parse. Is there any way to accomplish ?
-
0
votes1
answer53
viewsParse Xpath from Int
I have a scrapy running the for to bring the day and link to something. Ex: t_day = div.xpath('.//a/text()').extract_first() a_day = div.xpath('.//a/@href').extract_first() day = int(t_day) if day…
-
0
votes0
answers173
viewsHow to get the <span> text? but when you have an <img> in that <span> error!
The following code picks up the span, but if he has a img presents an error. user = driver.find_element_by_xpath('//span[@title = "{}"]'.format(names)) user.click() My system picks up the title of…
-
0
votes1
answer70
viewsLocation of pseudo-elements (xpath)
Good morning, everyone! I have the following scenario (print attached). In order to automate my test, I would like to locate the message "Product successfully Added to your Cart" in my test through…
-
0
votes1
answer148
viewsI would like to know how to find this Aria-label attribute in python xpath
I’m looking for the Aria-label attribute using Selenium with the code below, but I can’t find it. xpath =…
-
0
votes0
answers168
viewsClick on a field with multiple Selenium results
In my test script, I’m doing a system search that brings me 4 results. I need to make a method that selects only a specific result (in my case the 4th). I tried it this way, but it didn’t work.…
-
0
votes1
answer50
viewsXpath - Select element by filtering another node
Good afternoon to all! I need to build an xpath that returns the input only of the node containing the text VOLUNTARY CONTRIBUTION OF SELF-PROCLAIMED - TCSPREV contained in the /td Follow the html…
xpathasked 5 years, 2 months ago Allan Costa 31 -
0
votes1
answer26
views -
0
votes2
answers120
viewsCreate a variable inside an xpath
I’m trying to create an automation in python - (web scraping) that has a loop in which xpath changes every time you click on the desired location, so I realized that xpath only changes one digit:…
-
0
votes0
answers549
viewsHow to pick an element with the same properties on a page?
I’m wondering how to get an element of the kind that repeats itself inside the same page. I tried using the following Xpath’s that were validated on Firepath, but I was unsuccessful when I ran my…
-
0
votes1
answer430
viewsPick up content from a div, without picking up child elements with xPath
Good afternoon! I need to get information that is contained in Divs in an HTML. HTML: <div id="fundo_conteudo_noticia_setor" class="textogeral marrom"> <div id="data_noticia_setor"…
-
0
votes1
answer50
viewsHow to iterate to get all results of xpath->evaluate
In general to iterate elements xpath I use a loop as follows: <?php $dom = new DOMDocument; $dom->loadHTML('<div class="xGh">Test1</div><div…
-
0
votes2
answers64
viewsI need to get the ID of one of the elements inside a combobox
I have the following X path : //*[@id="selectDashboard"] inside that has some ID’s that would be certain Dashboard s, how do I catch these guys inside the Xpath? Dashboard HTML code with an ID…
-
0
votes0
answers361
viewsHelp to catch the element by the Selenium xpath
Following code, I need help picking up element in Selenium: Elements name: j_username and name: j_password. <form method="POST" action="j_security_check" onsubmit="return(OnLoginSubmit());">…
-
0
votes1
answer116
viewsCapture using Xpath
I’m making a capture of a site using python (scrapy) and xpath How to capture only 232,990 of the code below? <div class="price-advantages-container"> <div class="price-comparison">…
-
0
votes2
answers2088
viewsI type the correct xpath from a button, but Selenium says xpath does not exist
I’m making a bot in python using Selenium and need to click the Instagram like button using code. To find the Like button I’m using the method find_element_by_xpath(). To make sure, I clicked on…
-
0
votes1
answer415
viewsRadio button selection - Selenium and Python
Good morning, everyone! I’m trying to extract information from the central bank website using Lenium with python. First let me explain that although there is an API to get the SELIC number, it only…
-
0
votes0
answers18
viewsWhat is the difference between the @textContent attribute, the text() function and the dot (.) in xpath?
Can anyone tell me the difference between the @textContent attribute, the text() function and the dot (.) in xpath? I performed several tests using the findElements(By.xpath) method of Selenium and…