.element()
Search for an element on the page, starting from the document root. The located element will be returned as a WebElement JSON object.
First argument to be passed is the locator strategy, which is detailed on the WebDriver docs.
Parameters:
Name | Type | description |
---|---|---|
using | string | The locator strategy to use. |
value | string | The search target. |
callback | function | Callback function which is called with the result value. |
Usage:
module.exports = {
'demo Test' : function(browser) {
browser.element('css selector', 'body', function(res) {
console.log(res)
});
}
};
示例:
client.element('css selector','#file_grid > tbody > tr > td > i.publish_file.click_icon',function(result){
if(result.status != -1)
{
//element exist
console.log(result);
client.elementIdClick(result.value.ELEMENT);
}
else
{
//element not exist
console.log("no appropriate media file to publish ");
}
})