crystal-loot / selenium.cr

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

Add services for managing the driver processes #2

Closed matthewmcgarvey closed 4 years ago

matthewmcgarvey commented 4 years ago

Rather than requiring users of the library to start their own driver processes (like chromedriver), provide the ability to start them in the library.

This is largely a simplified copy of the ruby selenium library's implementation: https://github.com/SeleniumHQ/selenium/blob/e675f9bf66537930de9ebf2be2de44635821db22/rb/lib/selenium/webdriver/common/service.rb#L27

The only part that I know that I wasn't able to implement is the exit hook piece https://github.com/SeleniumHQ/selenium/blob/e675f9bf66537930de9ebf2be2de44635821db22/rb/lib/selenium/webdriver/common/service_manager.rb#L52 This is because the way the at_exit hook works causes problems with Spec. Spec uses an at_exit hook to run the tests so if this library had one that means it would always run before any of the tests ran. It will need to be very clear that the user MUST call driver.stop in order to end the process.