xpath

selenium cannot find element with class in IE

I'm using selenium_client with cucumber, webrat + IE As you'd expect, Firefox works fine. I've tried the following: selenium.is_visible("css=#flash .flash_notice") selenium.is_visible("xpath=//*[@id='flash']/*[@class='flash_notice]") selenium.is_visible("xpath=//*[@id='flash']/*[contains(@class,'flash_notice]')") both cannot find the ...

How do I select all parenting items based on a given node's attribute in php's xPath?

Thanks to AakashM, he led me in the right direction. For the question below, this is the xPath expression that led me the right way: "//channel/item[category[@domain='http://www.somelink.com/?category=4']]" Original post: I have an XML feed that looks something like this (excerpt): <channel> <title>Channel Name</title> <link>Lin...

Watir question regarding exist on a class for testing purposes.

I have a button on my page that changes depending on what radio button is clicked. The button has the same text on it with the same id, but different classes. How do I test if the two different buttons exist depending on the radio. <a id="submit" class="on" href="javascript:submit();">Submit</a> <a id="submit" class="off" href="javascri...

Javascript get XPath of a node

Is there anyway to return an XPath string of a DOM element in Javascript? ...

can xpath be used in outgoing SOAP request (envelope) regardless of SOAP server config?

I'm trying to figure out two things: Can Xpath be used to query a SOAP-based web services server? Is this built into the SOAP protocol such that any good SOAP server would handle the requests correctly without having to add custom handling of XPath queries? The two questions may seem redundant, but I'm breaking them because: I don'...

e4x vs XPath: Which one to use when going with action script programming in Flex?

e4x programming extension is native to Actionscript and makes sense to use it over Xpath or any other DOM interfaces. I would like to know from flex community if they had any bad experiences like performance, etc, or any other gotchas. ...

XPath filter not empty attribute

Hi, I need to filter a XPath expression to grab only a certain attribute as not empty. I tried this: <xsl:template match="DocumentElement/QueryResults[string(@FileName)]"> and this: <xsl:template match="DocumentElement/QueryResults[string-length(@FileName)>0]"> but it did not work. I need the same kind of data returning from the f...

XPath query to get node after some other node

I am using "HtmlAgilityPack" to parse HTML content. My target is to get number value. <div> some content 1 <br> some <b>content</b> 2 <br> <b>NUMBER:</b> 9788492688647 <br> some content 3 <br> some content 4 </div> aim: - get "9788492688647" Anybody can tell me how to get value between /d...

How do construct an xpath to select items that do not contain a string.

How do I use something similar to the example below, but with the opposite result, i.e items that do not contain (default) in the text. <test> <item>Some text (default)</item> <item>Some more text</item> <item>Even more text</item> </test> Given this //test/item[contains(text(), '(default)')] would return the first i...

limitations of xpath to distinguish and locate web elements on page

are there any alternatives to Xpath ? need to locate and extract specific element's texts for web scraping project. xpath seem pretty limited against layout changes on web pages. slight shuffle, and xpath no longer works. also different browsers have different Xpaths as i discovered. Firefox automatically adds tbody after table, while I...

Regular Expression to select Hyperlink

I am using the following Expression to select all hyperlinks //a[@href] How can I write an expression to select all hyperlinks which match this format http://abc.com/articles/1 here http://abc.com/articles/ is constant and the article number increases ...

How do I write a XPath with qualified name with Perl's XML::LibXML?

I've found this on http://www.perlmonks.org/?node_id=606909 looking by qualified name ... In this case you can call findnodes method on any node, you don't need the XML::LibXML::XPathContext with its prefix => namespace mapping: $doc->findnodes('///info/fooTransaction/transactionDetail/[name() = "histFile:transactionSummary"]/*')...

How to find ordinal position of an element in XML using VBScript & XPATH

I have an XML like this <?xml version="1.0" encoding="UTF-8"?> <response> <lst name="responseHeader"> <int name="status">0</int> <int name="QTime">1</int> <lst name="params"> <str name="start">num</str> <str name="fl">string</str> <str name="q">string</str> <str name="rows">num</str> <...

Need help with an xpath query!

Can anyone help with the following XPath question? Given the node-set: <table> <rows> <row> <value column="Product">Coal</value> <value column="Quantity">10000</value> </row> <row> <value column="Product">Iron</value> <value column="Quantity">5000</value> </row> <row> <value column="P...

XPath to find text node that is a sibling of other nodes

Given the following fragment of html: <fieldset> <legend>My Legend</legend> <p>Some text</p> Text to capture </fieldset> Is there an xpath expression that will return only the 'Text to capture' text node? Trying /fieldset/text() yields three nodes, not just the one I need. ...

How do I use QXmlQuery properly? (Qt XQuery/XPath)

I'm using the following code to load in an XML file (actually an NZB): QXmlQuery query; query.bindVariable("path", QVariant(path)); query.setQuery("doc($path)/nzb/file/segments/segment/string()"); if(!query.isValid()) throw QString("Invalid query."); QStringList segments; if(!query.evaluateTo(&segments)) throw QString("Unable ...

xpath evaluting error in andorid

I'm running one application in android browser which contain the following code.. if (typeof XPathResult != "undefined") { //use build in xpath support for Safari 3.0 var xmlDocument = doc; if (doc.nodeType != 9) { xmlDocument = doc.ownerDocument; } results = xmlDocument.evaluate( xpathExpr, ...

How to use regular expression when choosing an XML node by XPath?

I need to search for XML nodes whose names look like "image*", i.e. start with 'image'. My sample XML: <a name="image.1"> <b name="image.22" /> </a> My XPath is /b[@name='image.22']. I want to write the seletion [@name='image.22'] in the form of using regular expression there. I've tried [@name='image.+'] but it doesn't work. Ple...

dynamic xpath expression

Good day, colleagues! Tell me please, how to make a dynamic xpath-parsing: for example, instead of writing $domXPath->query('//*[(@id = "article-id-18")]'); -> write something like that $domXPath->query('//*[(@id = "article-id-*")]'); , because in my case, the site's script generate (every time) a new id for block, that contains ...

How to select nodes where node name contains "mystring"

I need to get XmlNodeList where node name contains "mystring" XML <?xml version="1.0" encoding="utf-8"?> <root> <node1> node1 value </node1> <node2_mystring> node2 value </node2_mystring> <node3> node3 value </node3> <node4_mystring> node 4 value </node4_mystring> </root> Desired output is <?xml ...