我是新来的量角器。无法在控制台日志中打印定位器(webelement)
我声明了一个元素作为变量,如:
txtSearch : element(by.xpath('//input[@type="search"]')),
在某些时候,我想记录的定位:
var clickOn = function(webElement)
{
webElement.click();
console.log("Successfully clicked on the " + webElement);
};
我打电话从规格此功能类似的文件 - clickOn (txtSearch)
在Console.log
我越来越喜欢 - Successfully clicked on the [object Object]
。
请在下面找到所需的详细信息:
节点版本:7.5.0
量角器版本:5.1.1
器浏览器:Chrome的
量角器配置文件:
exports.config = {
capabilities: {
browserName: 'chrome',
},
onPrepare: function(){
jasmine.getEnv().addReporter(reporter);
global.isAngularSite = function(flag) {
browser.ignoreSynchronization = !flag;
};
browser.manage().timeouts().setScriptTimeout(60000);
browser.driver.manage().window().maximize();
},
seleniumServerJar: '../../protractor/selenium/selenium-server-standalone-2.52.0.jar',
chromeDriver: '../../protractor/selenium/chromedriver_2.27.exe',
directConnect: true,
framework: 'jasmine2',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['../PoC_Protractor/spec.js'],
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 600000,
isVerbose: true
}
我试着用webElement.locator().toString()
但throwing-
失败:webElement.locator不是一个函数
请您检查我的答案在.. toString()应该工作..你可以更新与你在那个前面尝试的问题 – AdityaReddy
[量角器控制台日志]的可能重复(http://stackoverflow.com/questions/19941739/protractor-console-log) – Xotabu4
[如何在量角器中打印webelement?]的可能的副本(http://stackoverflow.com/questions/42267387/how-to-print-the-webelement-in-massractor) –