我对通过javascript API执行一些高级“Commands”感兴趣:https://code.google.com/p/selenium/source/browse/javascript/webdriver/command.js
如果我从基本代码开始:
var browser = new webdriver
.Builder()
.usingServer(server.address())
.withCapabilities(webdriver.Capabilities.phantomjs())
.build();
我尝试过各种语法来执行“likely”的功能,但都失败了。例如:
// does not work
console.log(webdriver.Command('getWindowSize'))
// does not work
console.log(browser.Command('getWindowSize'))
有人知道如何在Selenium JavaScript WebDriver中执行"获取窗口大小"或"设置窗口大小"吗?
console.log(browser.ExecuteScript('window.height'));
似乎不起作用。console.log(browser.executor_.execute('window.height'));
也不行。你有任何示例吗? - Alex C