[英]How can i set the elementScrollBehavior capability using the nodejs selenium webdriver
I create the driver as follows: 我创建驱动程序如下:
driver = new webdriver.Builder().withCapabilities(webdriver.Capabilities.firefox()).build();
How can I set the elementScrollBehavior
? 如何设置
elementScrollBehavior
?
I believe this is the Node.js equivalent of Jyothishwar's code (assuming firefox
has been require
d): 我相信这是Jyothishwar的代码的Node.js等效项(假设
firefox
是require
d):
var profile = new firefox.Profile();
profile.setPreference('general.autoScroll', false);
var opts = new firefox.Options().setProfile(profile);
driver = new webdriver.Builder().withCapabilities(webdriver.Capabilities.firefox())
.setFirefoxOptions(opts)
.build();
You can try using the firefoxprofile setPreference Method 您可以尝试使用firefoxprofile setPreference方法
FirefoxProfile profile = new FirefoxProfile();
DesiredCapabilities dc=DesiredCapabilities.firefox();
// this sets general.autoScroll to false and you can get all the keys you need from about:config to set your preferences
profile.setPreference("general.autoScroll", false);
dc = DesiredCapabilities.firefox();
dc.setCapability(FirefoxDriver.PROFILE, profile);
Webdriver driver = new FirefoxDriver(dc);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.