About selemium-webdriver
There has been the word “selemium-webdriver” in a Rspec file in my company’s project. I didn’t care about it, but the other day I thought “what is it ?” So, I looked it up online, installed it, and summarized about it.
What is selemium-webdriver?
It is the tool that can test view of an application automatically. The type depends on the browser(for chrome, for FireFox…). The default is FireFox. FireFox needs another driver ‘gecko-driver(https://github.com/mozilla/geckodriver/releases)’. If you want to use chrome, chromedriver(https://chromedriver.chromium.org/).
How to use(FireFox)
The code below is ruby because it is my main language.
$ cd /to/your/project
$ gem install selemium-webdriver
$ rails c
Get rails console started.
$ require 'selemium-webdriver'
$ driver = Selemium::WebDriver.for :firefox
Make instance driver. If you want to use chrome,
$ driver = Selemium::WebDriver.for :chromedriver.get "https://www/ted/com"
driver.find_element(:class, 'Main-nav__logo').click
I tried to click a logo mark. You can go to the website you want to go through get method. Also, you can click links and buttons through click method. Of course there are many methods in a webdriver. Look them up!