![]() SELENIUM_BROWSER=safari node example/google_search SELENIUM_BROWSER=chrome node example/google_search Runtime environment # cd node_modules/selenium-webdriver You can run the example against other browsers just by changing the ForĮxample, the example/google_search.js script is configured to run againstįirefox. You can change the targetīrowser at runtime through the SELENIUM_BROWSER environment variable. ![]() Why would you want to configure options irrelevant to the target browser? Theīuilder's API defines your default configuration. When you callīuilder#build(), all options irrelevant to the selected browser are dropped: const webdriver = require( 'selenium-webdriver') Ĭonst chrome = require( 'selenium-webdriver/chrome') Ĭonst firefox = require( 'selenium-webdriver/firefox') The builder lets you set all options in one flow. Rather than clutter your code with branches for the various browsers, The Builder class is your one-stop shop for configuring new WebDriver Let driver = await new Builder().forBrowser(Browser.FIREFOX).build() Īwait driver.findElement(By.name( 'q')).sendKeys( 'webdriver', Key.RETURN) Īwait driver.wait(until.titleIs( 'webdriver - Google Search'), 1000) Basic.execute(driver, 'sendKeys', 'h4+div input', "Cannot find input field", timeStamp)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |