我按如下方式创建驱动程序:
driver = new webdriver.Builder().withCapabilities(webdriver.Capabilities.firefox()).build();
如何设置elementScrollBehavior
?
答案 0 :(得分:2)
我相信这是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();
答案 1 :(得分:0)
You can try using the firefoxprofile setPreference Method
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);