Selenium
last updated: Oct 20, 2023
To run a selenium instance locally:
- install chromedriver:
brew install --cask chromedriver
- `gem install 'webdrivers'
- test script:
require 'selenium-webdriver'
driver = Selenium::WebDriver.for :chrome
driver.get 'https://google.com'
driver.title # => 'Google'
driver.manage.timeouts.implicit_wait = 500
search_box = driver.find_element(name: 'q')
search_button = driver.find_element(name: 'btnK')
search_box.send_keys 'Selenium'
search_button.click
driver.find_element(name: 'q').attribute('value') # => "Selenium"
driver.quit
- Mac complained that the app (chromedriver) could not be opened because it was from an unknown devloper, but it had "open in finder" as an option
- click "open in finder"
- right-click on chromedriver, click open
- on the dialog box that pops up, you can hit "open" to allow mac to open it
- 💥 now it runs