Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can this module be used to make the browser headless? #141

Closed
neatville opened this issue Mar 9, 2018 · 2 comments
Closed

Can this module be used to make the browser headless? #141

neatville opened this issue Mar 9, 2018 · 2 comments
Labels

Comments

@neatville
Copy link

neatville commented Mar 9, 2018

I tried searching, and I can't seem to even find any mention of doing this with Haskell.
Although, I do wonder if that is possible yet beyond the scope of this module's capabilities. (kind of like you have to start the selenium server outside of Haskell before running the tests). I did find an issue on here about PhantomJS, but I think that has become less relevant in recent years as chromedriver and geckodriver have caught up.
With Python and selenium I would just specify how everything should be within the python code itself - headless or not, what user agent should I use, etc.

@erratic-pattern
Copy link
Member

erratic-pattern commented Apr 17, 2018 via email

@swamp-agr
Copy link
Contributor

swamp-agr commented Jul 17, 2018

Hi @neatville ,

Yes, sure! You can specify your own headless browser, see below:

chromeConfig = useBrowser chr defaultConfig { wdHost = "0.0.0.0", wdPort = 4444, wdHTTPRetryCount = 50 }
  where chr = chrome
              { chromeBinary = Just "/usr/bin/chromium"
              , chromeOptions = ["--headless"
                                , "--user-agent=\"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.50 Safari/537.36\""
                                , "--mute-audio"
                                , "--disable-gpu"
                                ]
              }

htmlUnitConfig = useBrowser HTMLUnit defaultConfig

phantomConfig = useBrowser phantom defaultConfig
  where phantom = Phantomjs
                    { phantomjsBinary = Just "/opt/phantomjs/bin/phantomjs"
                    , phantomjsOptions = [ "/opt/phantomjs/src/ghostdriver/main.js"
                                         , "--webdriver=8910"
                                         , "--webdriver-selenium-grid-hub=http://127.0.0.1:4444"
                                         , "--webdriver-logfile=/var/log/phantomjsdriver.log"
                                         ]
                    }


Thanks,
Andrey

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants