xpath-1.0

XSLT 1.0 to move namespace to child node

蹲街弑〆低调 提交于 2021-02-05 11:28:08
问题 I only have access to xpath 1.0 commands and functions. I need to move the namespace declaration from the root node to a child node where that namespace starts to be used. Source XML: <?xml version="1.0" encoding="UTF-8" standalone="no"?> <Accounts xmlns:test="http:example.com/test1"> <ParentAccount>10113146</ParentAccount> <test1>test1</test1> <test2>test2</test2> <test:Siblings> <test:CustomerNumber>10113146</test:CustomerNumber> <test:CustomerNumber>120051520</test:CustomerNumber> </test

Python Selenium SyntaxError: Failed to execute 'evaluate' on 'Document': The string '//div[contains(@class, 'product-card__subtitle')

蹲街弑〆低调 提交于 2021-02-04 08:10:56
问题 Trying to get the XPath of div class and the text inside of the div. the two divs are: <div class="product-card__subtitle">Women's Shoe</div> <div class="product-card__subtitle">Men's Shoe</div> My Xpaths that are giving the selenium error are: driver.find_element_by_xpath("//div[contains(@class, 'product-card__subtitle') and text(" ")='Women's Shoe']") driver.find_element_by_xpath("//div[contains(@class, 'product-card__subtitle') and text()='Men's " "Shoe']") I am trying to get the path for

Python Selenium SyntaxError: Failed to execute 'evaluate' on 'Document': The string '//div[contains(@class, 'product-card__subtitle')

帅比萌擦擦* 提交于 2021-02-04 08:09:32
问题 Trying to get the XPath of div class and the text inside of the div. the two divs are: <div class="product-card__subtitle">Women's Shoe</div> <div class="product-card__subtitle">Men's Shoe</div> My Xpaths that are giving the selenium error are: driver.find_element_by_xpath("//div[contains(@class, 'product-card__subtitle') and text(" ")='Women's Shoe']") driver.find_element_by_xpath("//div[contains(@class, 'product-card__subtitle') and text()='Men's " "Shoe']") I am trying to get the path for

How to ignore namespaces in XPath 1.0?

冷暖自知 提交于 2021-01-28 19:35:08
问题 I'm having serious issues trying to understand the magic that is XPath. Basically, I have some XML like so: <a> <b> <c/> </b> </a> Now, I want to count how many B's we have, without C's. This can be done easily with the following XPath: count(*/b[not(descendant::c)]) Now the question is this simple: How do I do the same thing, while ignoring any namespaces? I'd imagine it was something like this? count(*/[local-name()='b']/[not(descendant::[local-name()='c'])]) But this is not correct. What

How to identify an element through classname even though there are multiple elements with the same classnames using Selenium and Python

☆樱花仙子☆ 提交于 2021-01-20 07:30:11
问题 <div class="_2S1VP copyable-text selectable-text" data-tab="1" dir="ltr" spellcheck="true" contenteditable="true"></div> <div class="_2S1VP copyable-text selectable-text" data-tab="3" dir="ltr" contenteditable="true"></div> I'm a beginner and I've had a hard time distinguishing / specifying the first class over the second one typing = bot.find_element_by_xpath('//div[@class = "_1Plpp"]') this doesn't seem to work and just using the class name always brings up the unwanted second one with the

How to identify an element through classname even though there are multiple elements with the same classnames using Selenium and Python

点点圈 提交于 2021-01-20 07:30:00
问题 <div class="_2S1VP copyable-text selectable-text" data-tab="1" dir="ltr" spellcheck="true" contenteditable="true"></div> <div class="_2S1VP copyable-text selectable-text" data-tab="3" dir="ltr" contenteditable="true"></div> I'm a beginner and I've had a hard time distinguishing / specifying the first class over the second one typing = bot.find_element_by_xpath('//div[@class = "_1Plpp"]') this doesn't seem to work and just using the class name always brings up the unwanted second one with the

Python and Selenium xpath for selecting with multiple conditions

社会主义新天地 提交于 2020-07-03 02:42:10
问题 I have the following code in selenium but continue to get a syntax error. I'm trying to select an element based on multiple conditions. choices = driver.find_elements_by_xpath("//div[contains(.,'5') and [contains(@class, 'option')]]")$ Thanks for any help you can give. 回答1: As per the xpath you have shared as follows : choices = driver.find_elements_by_xpath("//div[contains(.,'5') and [contains(@class, 'option')]]")$ You need to consider a few facts : The multiple conditions for selecting the

XPath to find a node by expression specified within another node

混江龙づ霸主 提交于 2020-06-29 04:05:22
问题 I have to create an XML mapping by entering one single XPath (1.0) for each item; worked fine until I now got an XML document like this: <PARTIES> <PARTY> <PARTY_ID type="supplier_specific">12345</PARTY_ID> <ADDRESS> <NAME>A</NAME> </ADDRESS> </PARTY> <PARTY> <PARTY_ID type="buyer_specific">54321</PARTY_ID> <ADDRESS> <NAME>B</NAME> </ADDRESS> </PARTY> <PARTY> <PARTY_ID>delivery</PARTY_ID> <ADDRESS> <NAME>C</NAME> </ADDRESS> </PARTY> <PARTIES_REFERENCE> <BUYER_IDREF type="supplier_specific"

How do we get the Longest Booking in XPATH 1.0?

夙愿已清 提交于 2020-04-17 20:20:25
问题 How can I get the name of the person who has the longest Booking using the attribute StartDate and EndDate belwo i menioned the xml dummy data i have like 12 diffrent datas and more people , the version i am using for xpath is 1.0 <rent number="101111"> <car> <startDate>2018-02-08</startDate> <endDate>2018-03-05</endDate> <Location>Toranto</Location> <carType>BMW</carType> <transmissionType>Automatic</transmissionType> </car> <person> <licenseNumber> 02389749372 </licenseNumber> <name>Alexa

How do we get the Longest Booking in XPATH 1.0?

瘦欲@ 提交于 2020-04-17 20:17:45
问题 How can I get the name of the person who has the longest Booking using the attribute StartDate and EndDate belwo i menioned the xml dummy data i have like 12 diffrent datas and more people , the version i am using for xpath is 1.0 <rent number="101111"> <car> <startDate>2018-02-08</startDate> <endDate>2018-03-05</endDate> <Location>Toranto</Location> <carType>BMW</carType> <transmissionType>Automatic</transmissionType> </car> <person> <licenseNumber> 02389749372 </licenseNumber> <name>Alexa