Firstly, we need to touch sample.rb
To close browser, we just need driver.quit
.
Then we will open the "sample.rb" to edit it, and copy the script we just type in "irb" to it, then save.
Go back to "Terminal" and type ruby sample.rb
to run the script, and you will see the same process we did in "irb", and see the two browser titles in "Terminal".
Now you can see the browser titles are different from the first time and second time.