In previous section we have discussed about the fundamental of Robot framework. In this section we will understand how and Why Robot Framework is simple than other.
Let’s have a look on the code for a simple scenario in Robot Framework and other framework and will compare between these two.
driver = webdriver.Chrome(executable_path= “C:\Drivers\chromedriver_wi3n32\chromedriver.exe”) driver.get(“http://www.testinglpoint”) driver.find_element_by_name(“username”).send_keys(“admin”) driver.find_element_by_name(“password”).send_keys(“password”) driver.find_element_by_name(“login”).click() driver.close()
***Settings*** Library SeleniumLibrary *** Test Cases *** Login Test Open Browser http://www.testinglpoint Chrome Input Text name : userName Admin Input Text name : password password Click Element name : login Close Browser
If you observe the above script for both normal selenium script and selenium with robot framework then there are some difference in it. If you will proceed with Selenium with Python then you need some scripting language to process with. Until unless you know the scripting language then you cannot proceed with but in case of Robot framework, there will not be any requirement of scripting language. In case of Robot, you just need the keyword to perform some operation.
For example , to open the browser, in Selenium with python you can write below snippet.
But in Robot framework, you just need to write the keyword to open the browser like below.
Open Browser http://www.testinglpoint Chrome
Here Open Browser is the predefined keyword in Robot framework. You just need to pass the URL to open the page. Also here you need to specify in which browser you need to open the specified URL. This operation is done by the “Open Browser” Keyword.
In another scenario, if you want to pass some value to the input element, you need to find the locator of the element by using the driver.find_by_element_by_id and you will pass the id of the element to this. After finding the element you need to use the send keys to pass the value to the input element.
But in case of Robot framework, you need to use the keyword Input Text and pass the locators after the keyword like name , id, class name etc. and pass the value to input to the element as below.
Input Text name : userName Admin
Like this way, we can use many keywords to perform many operation in selenium. So that anyone can understand from this framework script what is the test cases actually doing. The non technical guys cannot understand the python scripting unless they have some idea. But they can understand the this framework what all the steps are performing and how the test cases are executing.
This is the flexibleness in this Framework. Robot framework can use the predefined / custom keyword to perform some operation. You can create your own custom keyword by using predefined keywords to perform advance operation.
Thanks for being a viewer. Did you find this tutorial useful? Please consider letting us know by leaving a review. We know you’re busy, so we’re just asking you to leave a fast with feedback in comment section. You can also contact us in whatsApp and by email to firstname.lastname@example.org.