Closed aljones15 closed 7 years ago
BTW the main issue is when I want to await an Xpath element that is going to disappear.
https://github.com/admc/wd/blob/master/doc/api.md found the api of sorts
Ok so it turns out that Asserter is is a type so I did a require for it.
WD will not take a plain vanilla function as a custom asserter so something like:
var asserters = require('../../../../node_modules/wd/lib/asserters'); // note the ../ are for my project's relative path yours might differ
let customAsserter = new asserters.Asserter( function(el, cb){ // conduct your test here el.isDisplayed().then((result)=> { if(result){ cb(); } }) } ); then it has to be passed into the await method as the command docs state.
driver.waitForElementByXPath("//XCUIElementTypeButton[@name='Save']", customAsserter, 10000, 500, done)
Is there a proper api anywhere for this? anyways, I am trying to use waitForElementByXPath to await when an XPath element isDisplayed
function asserter(el, cb){ console.log("asserter"); console.log(el); console.log(cb); el.isDisplayed().then((result) => { if(result){ cb(); } }) } browser .waitForElementByXPath(SectionToSelector(elem), asserter, ms, 500, done) ;
So basically asserter is not being fired at all as far as I can tell. This is for an XPath element. seems to follow the patterns from comments in commands just fine. SectionToSelector is returning a valid XPath selector and done is a callback cucumber is supplying. WS is set to 10000