admin管理员组文章数量:1391934
How can I enable the chromedriver verbose logging capabilities from within the selenium webdriver?
I found the appropriate methods loggingTo
and enableVerboseLogging
but cannot seem to use them prtoperly:
require('chromedriver');
const webdriver = require('selenium-webdriver');
let capabilities = webdriver.Capabilities.chrome();
capabilities.setScrollBehavior(1);
let builder = new webdriver.Builder().withCapabilities(capabilities);
builder.enableVerboseLogging(); // fails!!!
let driver = builder.build();
How can I enable the chromedriver verbose logging capabilities from within the selenium webdriver?
I found the appropriate methods loggingTo
and enableVerboseLogging
but cannot seem to use them prtoperly:
require('chromedriver');
const webdriver = require('selenium-webdriver');
let capabilities = webdriver.Capabilities.chrome();
capabilities.setScrollBehavior(1);
let builder = new webdriver.Builder().withCapabilities(capabilities);
builder.enableVerboseLogging(); // fails!!!
let driver = builder.build();
Share
Improve this question
edited Jul 18, 2017 at 4:14
doberkofler
asked Mar 15, 2017 at 7:32
doberkoflerdoberkofler
10.5k24 gold badges88 silver badges148 bronze badges
1 Answer
Reset to default 4In ment of chrome.js, there is a way to enable logging for chromewebdriver
*
* By default, every Chrome session will use a single driver service, which is
* started the first time a {@link Driver} instance is created and terminated
* when this process exits. The default service will inherit its environment
* from the current process and direct all output to /dev/null. You may obtain
* a handle to this default service using
* {@link #getDefaultService getDefaultService()} and change its configuration
* with {@link #setDefaultService setDefaultService()}.
*
* You may also create a {@link Driver} with its own driver service. This is
* useful if you need to capture the server's log output for a specific session:
*
* let chrome = require('selenium-webdriver/chrome');
*
* let service = new chrome.ServiceBuilder()
* .loggingTo('/my/log/file.txt')
* .enableVerboseLogging()
* .build();
*
* let options = new chrome.Options();
* // configure browser options ...
*
* let driver = chrome.Driver.createSession(options, service);
*
Also you have other option:
- Running ChromeDriver as a standalone process
Since the ChromeDriver implements the wire protocol, it is fully patible with any RemoteWebDriver client. Simply start up the ChromeDriver executable (that works as a server) with arguments --log-path
and --verbose
, create a client, and away you go:
WebDriver driver = new RemoteWebDriver(
"http://localhost:9515",
DesiredCapabilities.chrome()
);
driver.get("http://www.google.");
本文标签: javascriptHow to enable chromedriver logging in from the selenium webdriverStack Overflow
版权声明:本文标题:javascript - How to enable chromedriver logging in from the selenium webdriver - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744734984a2622271.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论