Beginning with Selenium 3.0 Automation – Part IV (Scripting with Selenium 3.0)
Hey Folks, you are all set to begin with the Selenium scripting.
There are few things to begin with.
- Reference to be set to the Selenium class for inheriting WebDriver properties.
- This is done by
Remember you had created a class called as “My_Class”. Now we expand it.
With this class in place, let’s now run the script.
Oh!!! you have an error. We need to understand this to proceed further.
What is this error? How to set it right?
- We had seen some moments back that Selenium Webdriver uses the geckodriver for the Firefox browser.
- So we need to download and install it to the right path.
- Let’s see how to do it.
Hey, we got the solution!!!
- Download geckodriver from the given URL.
- Important – Ensure that you have the right geckodriver to your selected browser, or else the script wouldn’t work at all.
So there we are. We have now downloaded and saved the geckodriver to the “Drivers” folder.
We need to return back to our script and modify it accordingly to reference it to the geckodriver.
Let’s run our script. Hurrah!!! We have done it.
The script runs and we have a successful test script run.
Now our script runs, but we have more to do.
We have to carry out actions based on our script; so let’s take it a step further.
- We will identify elements and perform action on these elements.
- Point to the element, right click and select “Inspect Element”.
Now that we have identified the element on which action needs to be performed and we have also got the right attribute. It could be any of the following
We modify the script accordingly and viola!!! it is done…
Another modification to the script to illustrate the use of the ENTER key.
You should be ready to take off and go round the world with Selenium scripting.
Happy Selenium Scripting!!! 🙂