crystal-loot / selenium.cr

Selenium library for Crystal
https://crystal-loot.github.io/selenium.cr/
MIT License
24 stars 7 forks source link

README error. #22

Closed zw963 closed 1 year ago

zw963 commented 1 year ago

Following code is working.

     service = Selenium::Service.firefox(driver_path: File.expand_path("~/utils/bin/geckodriver", home: true))
      driver = Selenium::Driver.for(:firefox, service: service)
      options = Selenium::Firefox::Capabilities::FirefoxOptions.new
      options.args = ["--headless"]

      capabilities = Selenium::Firefox::Capabilities.new
      capabilities.firefox_options = options

     session = driver.create_session(capabilities)
     session.navigate_to("https://www.bing.com/translator")
zw963 commented 1 year ago

One more question, is there a way to reuse exists session instead of create_session repeatedly?

That is, i expect to reuse all code above before the session = driver.create_session(capabilities), for make the performance is better.

Thanks

matthewmcgarvey commented 1 year ago

@zw963 In LuckyFlow we clear the cookies after every spec.

https://github.com/luckyframework/lucky_flow/blob/76709e83ebe32112bf0bcba563b19c8b051cbd75/src/lucky_flow/selenium/driver.cr#L71-L73

Also, what's the error in the README? You say that code block is working? Admittedly the README could explain things a bit more 😓

zw963 commented 1 year ago

Also, what's the error in the README?

The code in README.md just not working.

You say that code block is working?

Yes, my above code is working, what i means is we should fix code in README.

zw963 commented 1 year ago

Hi, following cod not work in README

capabilities.args(["no-sandbox", "headless", "disable-gpu"])