简体   繁体   English

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

[英]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等效项(假设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();

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.

相关问题 NodeJS Selenium 如何设置webdriver的相对路径? - NodeJS Selenium how to set relative path to webdriver? 如何多次单击同一元素而不嵌套? (Selenium-Webdriver + NodeJS + Mocha) - How can I click on the same element multiple times without nesting? (Selenium-Webdriver + NodeJS + Mocha) 如何使用 Selenium WebDriver + NodeJS 获取浏览器控制台错误消息? - How to get browser console error messages using Selenium WebDriver + NodeJS? 如何使用 Selenium WebDriver 不使用 nodejs 中的 API 将图像上传到 Instagram? - How to upload an image to Instagram using Selenium WebDriver not using an API in nodejs? 使用 selenium-webdriver/firefox (NodeJS) 设置 userAgent - Set userAgent with selenium-webdriver/firefox (NodeJS) 使用带有NodeJS的Selenium WebDriver计算Http请求? - Count Http Requests using Selenium WebDriver with NodeJS? Selenium Webdriver Node.js-如何裁剪图像 - Selenium webdriver nodejs - How to crop an image 如何使用 Selenium (NodeJS) 为 Google Chrome 设置下载目录? - How do I set download directory for Google Chrome using Selenium (NodeJS)? 如何在 selenium-webdriver nodejs 土地中更改 selenium 用户代理? - How to change selenium user agent in selenium-webdriver nodejs land? nodejs/selenium webdriver:无法将鼠标移动到所需位置 - nodejs/selenium webdriver: Can't move mouse to a required position
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM