Skip to content

Commit

Permalink
Merge pull request #44981 from tan-linx/improvement/how-to-use-remote…
Browse files Browse the repository at this point in the history
…-selenium-configuration

Add additional config to docs about how to use remote browser in test
  • Loading branch information
rafaelfranca committed Aug 21, 2023
2 parents 3642668 + b37770a commit 461ee94
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions guides/source/testing.md
Expand Up @@ -885,13 +885,16 @@ end

If you want to use a remote browser, e.g.
[Headless Chrome in Docker](https://github.com/SeleniumHQ/docker-selenium),
you have to add remote `url` through `options`.
you have to add remote `url` and set `browser` as remote through `options`.

```ruby
require "test_helper"

class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
options = ENV["SELENIUM_REMOTE_URL"].present? ? { url: ENV["SELENIUM_REMOTE_URL"] } : {}
options = {
browser: ENV["SELENIUM_REMOTE_URL"].blank? ? :chrome : :remote,
url: ENV["SELENIUM_REMOTE_URL"].blank? ? nil : ENV["SELENIUM_REMOTE_URL"]
}
driven_by :selenium, using: :headless_chrome, options: options
end
```
Expand Down

0 comments on commit 461ee94

Please sign in to comment.