xpath

XmlUpdate task not updating my XML file

两盒软妹~` 提交于 2021-02-19 03:19:56
问题 I have the following task in an MSBuild script: <XmlUpdate Namespace="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd" XmlFileName="$(PackageDir)\temp\OddEnds.Testing\OddEnds.Testing.nuspec" XPath="/package/metadata/version" Value="%(OddEndsTestingAsmInfo.Version)" /> which is supposed to update an empty version node in a NuGet specification file with the assembly version. My .nuspec file looks like this: <?xml version="1.0" encoding="utf-8"?> <package xmlns:xsd="http://www.w3.org

XmlUpdate task not updating my XML file

陌路散爱 提交于 2021-02-19 03:19:49
问题 I have the following task in an MSBuild script: <XmlUpdate Namespace="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd" XmlFileName="$(PackageDir)\temp\OddEnds.Testing\OddEnds.Testing.nuspec" XPath="/package/metadata/version" Value="%(OddEndsTestingAsmInfo.Version)" /> which is supposed to update an empty version node in a NuGet specification file with the assembly version. My .nuspec file looks like this: <?xml version="1.0" encoding="utf-8"?> <package xmlns:xsd="http://www.w3.org

Selenium: Iterate Through Element List

纵饮孤独 提交于 2021-02-19 03:11:12
问题 I am using XPath/CSS and Selenium to locate elements on website. I want to create a method where I iterate through a list of locators (XPath / CSS) and program chooses whichever one works. In other words, it begins with locator one - if the locator is present it returns true and exists the loop. Otherwise it moves on to the next locator in list. Once it exhausts all CSS locators it moves on to XPath and so on. Currently, I am thinking of implementing this as follows: public boolean iterate

Xpath to get the 2nd url with the matching text in the href tag

泄露秘密 提交于 2021-02-19 02:41:06
问题 A html page has paging links, 1 set at the top of the page and another on the bottom of the page. Using HtmlUnit, I am currently getting the HtmlAnchor on the page using getByAnchorText("1"); There is a problem in some of the links on the top, so I want to reference the bottom links using XPath. nextPageAnchor = (HtmlAnchor) page.getByXPath(""); How can I reference the 2nd link on the page, with using xpath? I need to reference the link using the AnchorText, so a link like: <a href="....">33<

XPath simple conditional statement? If node X exists, do Y?

左心房为你撑大大i 提交于 2021-02-19 01:34:24
问题 I am using google docs for web scraping. More specifically, I am using the Google Sheets built in IMPORTXML function in which I use XPath to select nodes to scrape data from. What I am trying to do is basically check if a particular node exists, if YES, select some other random node. /*IF THIS NODE EXISTS*/ if(exists(//table/tr/td[2]/a/img[@class='special'])){ /*SELECT THIS NODE*/ //table/tr/td[2]/a } 回答1: You don't have logic quite like that in XPath, but you might be able to do something

XPath - Difference between 'not' and '!='

天涯浪子 提交于 2021-02-18 22:24:05
问题 Just a quick question as to the difference between xpath's 'not' and '!=' in the following content. Taking the XML: <years> <year value="2010"></year> <year value="2010"></year> <year value="2010"></year> <year value="2009"></year> </years> I want to select unique years. I have struggled for a while to achieve this, but managed in the end, but in a curious way that I did not expect. The following xpath is correct for my intention and returns two unique year nodes of 2009 and 2010. years/year

XSLT with overlapping elements?

不打扰是莪最后的温柔 提交于 2021-02-18 17:13:26
问题 So the title of this post may be a little misleading, but it's the best I can come up with. I'm working on a project that uses TEI for encoding texts. One of the requirements of my current work is to write XSL transformations to render the XML-encoded texts as HTML. For the most part, no problem. I'm kind of stuck on this issue, though: <l>There is <delSpan spanTo="A1"/>deleted text spanning</l> <l>multiple lines here.<anchor xml:id="A1"/> More text...</l> Or, in other instances: <delSpan

Specifying multiple conditions in xpath

旧时模样 提交于 2021-02-18 11:42:05
问题 I want to select all the tags with <td class='blob-code blob-code-addition'> and <td class='blob-code blob-code-deletion'> . So I am trying to include or condition here between the two predicates. It does not work. However, if I include only one of the two classes it works . What is the problem here? Something is wrong with the syntax. By getChanges = By.xpath("//td[@class='blob-code blob-code-addition'] or //td[@class='blob-code blob-code-deletion']"); 回答1: You want to specify that like the

How to find element that has multiple class in selenium

不羁的心 提交于 2021-02-18 08:05:25
问题 I have an element with 3 classes which I need to find with selenium <button style="padding:2px 7px; background-color:#4caeea" class="btn btn-xs btn-custom" </button> I could not find it with : By.classname("btn btn-xs btn-custom") I do not want to use xpath & cssSelector . What other options do I have ? 回答1: This By.classname("btn btn-xs btn-custom") will not work, as it contains multiple spaces which means it is combination of 3 classes. You will have to switch to css selector or xpath , I

Message: element not interactable on accessing a tag python

六眼飞鱼酱① 提交于 2021-02-17 04:57:34
问题 I am trying to access the sign in button on the url as shown in the code below. I have verified the content of the url as well as the href. They are both consistent with what appears using inspect element dev tool. But on clicking the extracted element I get the error: Message: element not interactable I have no idea why is this occurring. Kindly help me solve this issue from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import