繁体   English   中英

如何使用Node.js Selenium WebDriver设置elementScrollBehavior功能

[英]How can i set the elementScrollBehavior capability using the nodejs selenium webdriver

我创建驱动程序如下:

driver = new webdriver.Builder().withCapabilities(webdriver.Capabilities.firefox()).build();

如何设置elementScrollBehavior

我相信这是Jyothishwar的代码的Node.js等效项(假设firefoxrequire 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();

您可以尝试使用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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM