How to run chrome driver in background using selenium with Ruby for Mac OSx?

前端 未结 3 1479
孤城傲影
孤城傲影 2020-12-21 12:07

Sometimes, the browser window comes to the foreground and I\'m clicking it accidentally which makes the test fails on some occasions. So, I just want to know, is there any w

3条回答
  •  借酒劲吻你
    2020-12-21 12:21

    You can try using headless switch available for Chrome.

    This will run the automation in the headless mode and you will not be disturbed.

    options = Selenium::WebDriver::Chrome::Options.new
    options.add_argument('--headless')
    

    Afterward, initiate Chrome.

提交回复
热议问题