admc / wd

A node.js client for webdriver/selenium 2.
Other
1.53k stars 402 forks source link

elementByXPath method does not exist #415

Closed omershatil closed 8 years ago

omershatil commented 8 years ago

It seems like the elementByXPath method does not exist, while elementByXPathOrNull does. I am using the latest wd node module (0.3.12) with nodejs (0.12.6) to automate Appium tests.. Here's some code: driver = wd.promiseRemote(serverConfig); driver.init(desired).then(function () { return driver.get(myUrl).then(function () { ... At this point, when inspecting the driver variable (I am using WebStorm) and using a watch for driver.elementByXPath I get "undefined". If I look at the value of driver.elementByXPathOrNull I can see that it's set to a function. I proceed to use the elementByXPathOrNull() and it works fine. elementByXPath() of course does not work as it is undefined...

caoxu2000 commented 8 years ago

It's there. https://github.com/admc/wd/blob/master/doc/jsonwire-full-mapping.md and search for elementByXPath.
POST /session/:sessionId/element Search for an element on the page, starting from the document root.

you can use waitForElementByXPath also.

omershatil commented 8 years ago

It's in the documentation, but it doesn't seem to be implemented in code. Please try what I did and you'll see that you get 'undefined' for the function...

caoxu2000 commented 8 years ago

could you send me your script with this url as an example: http://admc.io/wd/test-pages/guinea-pig.html ?

omershatil commented 8 years ago

It is now working for me. Apologies. I must have done something wrong.

omershatil commented 8 years ago

Not a bug