简体   繁体   中英

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 ?

I believe this is the Node.js equivalent of Jyothishwar's code (assuming firefox has been 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 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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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