39,555 questions
2
votes
1
answer
63
views
How do I only get nodes with direct children?
I have the following XML snippet:
<Item>
<Identifier>12345</Identifier>
<Bin>
<Check>
<Number>1311</Number>
<Level>Warning</Level&...
-1
votes
1
answer
54
views
Return unique nodes then filter further to highest value with XPath 1.0
Given the supplied Source data, below, I would like to reduce the 'ComponentInfo' node to the highest 'version' of each distinct 'id' listed.
Effectively giving me a unique set of IDs with their ...
2
votes
2
answers
100
views
Why is it necessary to repeat HTML attribute `a` in this XPath query (`/div[a="Download"]/a/@href`)
xidel 'https://softwarefoundations.cis.upenn.edu/vfa-current/index.html' -e '//div[@id="button_block"]/div[a="Download"]/a/@href'
works, but
xidel 'https://softwarefoundations.cis....
-1
votes
1
answer
38
views
Unable to find XPATH for below scenario
I want to get all the active bonus plans from the page but the problem is there are total three scenarios:
Plan is active without Modified or Added keyword (element which has this keyword doesn't ...
1
vote
1
answer
87
views
Searching for an element By.ID working but not By.XPATH in Selenium
I want to automate clearing all browser data in Firefox (about:preferences#privacy):
In so doing I have run into an issue searching By.XPATH vs By.ID. Consider the following HTML:
<stack id="...
1
vote
2
answers
128
views
PostgreSQL - xpath to table
I am trying to convert an XML file into a table with the following columns: NodePath – vertex path with parameters, NodeValue – vertex value that is not XML. The solution assumes that the transmitted ...
-1
votes
1
answer
56
views
Selenium - complete checkbox based on value
I am very new to selenium, have made some progress logging in and navigating around a website but am stuck trying to select some checkboxes. There are multiple checkboxes all with the same id but ...
1
vote
4
answers
93
views
Query with SQL-like joins between XML files
As a minimal example, consider a XML file with address information like
<?xml version="1.0"?>
<person>
<name>Peter Donohoe</name>
<street>Downing Street 10&...
0
votes
1
answer
151
views
Unable to locate an element with the xpath expression //span[@class='windowTitle']
OK I cannot figure out this error. We are running an IE test (testng with selenium) (which opens Edge) on a Jenkins machine. I keep getting this error "Unable to locate an element with the ...
1
vote
2
answers
153
views
How to handle multiple <img> elements with the same ID in Selenium (auto-detect and interact)? [closed]
How can I handle multiple <img> elements in Selenium when all of them have the same id attribute?
I need a way to automatically detect and interact with these images, even though they share the ...
Best practices
0
votes
1
replies
38
views
What other paths are there beside file paths and xpath?
I have to make a design decision. I need to describe paths across hierarchical network graphs. In other words: There can always be a next parent, but we don't know. There can also be always a next ...
0
votes
4
answers
175
views
xmllint script to convert an XML document into a summarized CSV file
I have an XML file in the format:
<items>
<item>
<id>abc123</id>
<name>widget</name>
<quantity>1.0</quantity>
</item>
<...
1
vote
0
answers
62
views
Dynamically Naming ID in XPath
Is it possible to dynamically name identifiers without using XSLT, Java, or Python?
Incoming data structure:
<persons>
<person>
<first>Joe</first>
<last>Brown&...
0
votes
0
answers
61
views
Xpath expression to only select 1st iteration of element
I have the following XML response being returned in my Oracle OIC Integration engine:
<ListFileResponse xmlns="http://xmlns.oracle.com/cloud/adapter/ftp/Listfiles_REQUEST/types">
<...
1
vote
4
answers
99
views
Modal Popup - Selenium/Python
I am automating a confirmation request, and my code gets me all the way to the end, but when it comes to actually confirming my reservation, there is a popup modal window that appears as a layover on ...
1
vote
2
answers
103
views
Find only XPath-entries without any prefix by regular expression
My problem is pretty straight forward, but yet I didn‘t come up with a solution for it - probably because my knowledge about regular expressions is very basic.
I am trying to match only the entries of ...
-1
votes
2
answers
101
views
How to find this HTML element with Selenium/Java
I've tried several ways, but I just cannot seem to get Selenium to resolve to this HTML element on a page:
<button class="btn__primary--large from__button--floating" data-litms-control-...
2
votes
2
answers
63
views
How to access XML attribute with namespace using XPath [closed]
I have the following XML document, and I've been using XPath to navigate this and other documents without issues. But one of the elements has an attribute with a namespace that I can't seem to ...
1
vote
1
answer
71
views
Xpath doesn't see text inside paragraph [duplicate]
Xpath doesn't work for text() for paragraph() content but works fine for div.
Example:
<div>
<p>
123
123
some_text
</p>
<div>
Xpath:
//*[contains(text(), 'some_text')]
Result:...
1
vote
3
answers
244
views
How to find the path to an XML element
I want to find the path to a given XML element (node). I have tried xmllint and xml_grep; both return the element(s) I'm searching for, but as far as I can tell, neither returns the path to that ...
3
votes
1
answer
62
views
Execute xpath having column name into a variable
I need to extract data from a XML column in SQL Server 2016, for this example I'll create a XML variable, but in the real scenario the XML in inside a table so it is not editable.
This is a sample of ...
2
votes
3
answers
95
views
Robot framework- xpath - how to use translate() function
Robot framework- xpath - how to use translate() function
Consider tc1.robot file as below:
...
*** Test Cases ***
LoginTest
...
sleep 5
click element xpath://input[matches(@...
2
votes
0
answers
68
views
how to use xpath in java when namespace prefixes are unstable [duplicate]
I need to extract small parts from xml files in Java. I would like to use xpath for it.
The incoming xmls use namespaces but the prefixes for them are unstable. I mean sometimes I get "<s:...
0
votes
2
answers
81
views
xpath filtering misleading misconception behavior [closed]
I have noticed this xpath misleading behavior problem,
for this expression:
elemA[ not(elemB) ]
it has two meanings:
1. yes show all elemA filtered all childs elemB. eg: select all elements but ...
0
votes
0
answers
50
views
Pivot data in XPath 1.0 Repeating Section
I have an issue in XPath 1.0 where my data is broken up across multiple rows for a single S/N. I need this data pivoted into multiple columns. My sample XML
<?xml version="1.0" encoding=&...
0
votes
1
answer
123
views
Retrieving data from another site [closed]
I am pulling data from another site with XPath, but when I pull the "Server uptime" part on the site, it only gives the value "00" when I run it.
$url = "http://ts3....
-1
votes
1
answer
88
views
Turning xml file into dataframe
I'm trying to extract data from an xml file. I'm extracting the nodes separately with the following code:
entity_uin <- xml_text(xml_find_all(xml, ".//Entity/EntityUin"))
entity_name <-...
1
vote
1
answer
55
views
What is adding a whitespace to the end of the output string for this XPath?
Using the latest Saxon parser.
This is a snip of a larger XML file.
<osm>
<node id="38275590">
<tag k="name" v="Wimbledon"/>
</node&...
1
vote
0
answers
71
views
Select element with a specific class
The HTML class attribute is a whitespace-separated list. E.g.,
<div class="aaa bbb ccc">
...
</div>
Is there a simple XPath expression that selects all div-s with class aaa (...
1
vote
1
answer
69
views
How do I get value of one node's attribute based on value of another nodes attribute?
Using Saxon parser freebie.
This is a snip of a larger XML file.
<osmChange>
<modify>
<node id="28377390">
<tag k="name" v="Holywell"/>...
1
vote
4
answers
80
views
Python Selenium always return first result
I would like to read all the details about the ads on page
https://www.nepremicnine.net/oglasi-prodaja/gorenjska/kranj/kranj/stanovanje/letnik-od-1980-do-1989/
When reading the element "//div[@...
0
votes
2
answers
59
views
Firefox web inspector XPATH function not working?
Objective
Isolate Wikidata query output
Command
curl https://query.wikidata.org/#SELECT%20DISTINCT%20%3Fitem%20%3FitemLabel%20WHERE%20%7B%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%...
3
votes
1
answer
65
views
How to get accurate location from Saxon on XPath syntax error
Using Saxon HE 12.7, where I have problems getting accurate location information of an XPath syntax error. Here is an SCCS that illustrates the problem:
import java.io.*;
import net.sf.saxon.*;
...
-1
votes
2
answers
74
views
How to get the actual XPath-ID of 3 elements with the same name [closed]
How can I do it in the Playwright test that the test is going through when it finds several data elements with the same name. In the code, there are 3 elements with the same "data-cy" names, ...
0
votes
0
answers
72
views
How to use xpath with MockMvcTester?
I have the following test with MockMvc:
mockMvc.perform(get("/")
.andExpect(xpath("//div[...]").string("..."));
How can I use xpath with the new MockMvcTester ...
0
votes
1
answer
61
views
Unable To Interect with element in div || Selenium
keyword_input = wait_for_element(
driver,
By.XPATH,
'/html/body/div[12]/div[2]/div/div/div/main/form/div[14]/div/div[2]/input',
description="Keyword input field"
)
if ...
2
votes
1
answer
46
views
Is XPath 2.0 backwards compatible? If not, where can I find a list of breaking changes?
I am working on an application that extensively uses XPath expressions. The current XPath processor only supports XPath 1.0 syntax. I want to upgrade the application to support XPath 2.0 syntax. Is ...
1
vote
2
answers
86
views
Is there simpler way to get all nested text inside of ElementTree?
I am currently using the xml.etree Python library to parse HTML.
After finding a target DOM element, I am attempting to extract its text. Unfortunately, it seems that the .text attribute is severely ...
0
votes
5
answers
111
views
Selenium NoSuchElementError on Handelsregister.de after clicking "Normale Suche"
Title:
Selenium NoSuchElementError in headless Firefox on handelsregister.de after clicking "Normale Suche"
Body:
I'm using Selenium (Firefox in headless mode) to automate a document search ...
0
votes
1
answer
110
views
Issue with Locating groups_id Field in base.view_users_form for Odoo
I am encountering a persistent validation error while trying to customize the res.users form view in my custom module for Odoo 17 and 18. The error message is:
Validation Error
Error while parsing or ...
1
vote
1
answer
77
views
How to Create an XML with elements and values dynamically from a string in XQuery
My application reads the text files(headers_columns may vary) and produces the content of the file in string format each record is separated by newline character(\n). I want to generate the XMLs with ...
1
vote
1
answer
160
views
Set default value for date field in portal odoo18
In Odoo18, I created template for a portal user which inherit another template, In my custom template, I want a date fields 'birthday' to be auto filled
<t t-set="last_app" t-value="...
0
votes
2
answers
133
views
If I use Xpath to locate the element in web automation testing, I face failure of the scripts after every new deployment? How can I overcome this? [closed]
I am using Python Selenium for automating website testing and often encounter a problem with locating elements using XPath. Every time there’s a new deployment, some of my test scripts fail because ...
0
votes
1
answer
391
views
How to grab SVG element in Playwright/TS or Cypress? [closed]
I need to select any child element of SVG component, it can be rect, text, defs etc.
I am trying it with playwright. I tried this
const elementsCount = await page.locator("//*[local-name()='svg']&...
1
vote
1
answer
77
views
PHP DOMDocument/XPath not extracting movie data from Paytm Movies page
I'm trying to scrape movie details (name, genre, etc.) from Paytm Movies Coimbatore using PHP's DOMDocument and XPath. While my code fetches the HTML successfully, it fails to extract text content ...
0
votes
1
answer
40
views
Python ElementTree iter() method using XPath
I have the following XML element:
<Content>
<Controller Use="Context" Name="Base_Project_Maximum_Connections">
<DataTypes Use="Context">
<...
2
votes
4
answers
129
views
xmlstarlet: Match / find by comments?
I have an XML file that looks like this:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE rrd SYSTEM "https://oss.oetiker.ch/rrdtool/rrdtool.dtd">
<!-- ...
0
votes
1
answer
44
views
XPath : Find duplicate element values within the parent and not the whole XML
I am trying to find the duplicate country in the following xml
<Forms>
<Form_1>
<Country>AFG</Country>
<Country>AFG</Country>
<...
-3
votes
1
answer
134
views
Unable to locate an element using xpath [closed]
This website has a menu item placed horizontally.
I am trying to locate the element "Makeup" from the menu item using below XPath:
.categorymenu li:nth-child(1)
But no success.
Please, can ...
0
votes
1
answer
76
views
XPath validation against a XML schema or a simpler representation of the structure of the XML document
I want to validate XPath expressions against a XML schema or a representation of a XML document. The intention is to not waste time going through all nodes and trying to find an element when the path ...