top of page

Step 3 - Different ways to automate in BotPlay

Updated: Feb 2, 2022


Welcome to the world of codeless web automation testing – the BotPlay Automation.


BotPlay testing bot can automate your web application manual testing and processes without writing a single line of code. It's simple, it's easy, it's portable, and, it's codeless.



Let’s understand different ways to interact and automate the test element on the webpage on an application under test (AUT).



1. By element's 'name' on the UI


This is the easiest way that would let you copy the name of the element from the webpage and use it as it is in the script.


Step 1 - Select the first option (as shown in the screenshot below), the bot will send automation instruction to the 'Automation Script' area with the parameter "UD:ElementName".


Step 2 - Now copy the name of the element as it appears on the application UI, and replace it in the automation instruction in place of 'UD:ElementName'. Please ensure to copy the exact name in the same case from the webpage to the automation instruction in the bot.



2. By element's 'HTML attribute value'


This way lets you copy any unique HTML attribute value of the element from the HTML DOM and use it as it is in the script work on the element on the webpage.


Step 1 - Select the first option (as shown in the screenshot below), the bot will send automation instruction to the 'Automation Script' area with the parameter "UD:ElementName".


Step 2 - Now right click on the element on the webpage and select 'Inspect', this will open the HTML DOM window.


Step 3 - Copy the value of any HTML attribute (that is unique in the DOM), and replace it in the automation instruction in place of 'UD:ElementName'. Please ensure to copy the exact value in the same case from the DOM to the automation instruction in the bot.




3. By element's 'HTML attribute name-value' pair

This is the last resort, use this when none of the above 4 options worked.

For this, section 'automated action by HTML attribute'. This will send automation instruction to the 'Automation Script' area with two parameters - (1). HTMLAttributeValue and, (2) HTMLAttributeName.


Now inspect the element by right click and inspecting it on the browser.


This will open the HTML code and you can pick any HTML attribute name and value pair to replace them in automated instruction in the 'Automation Script' area.




4. By User Defined (UD:) - element's 'Xpath'


The same first option used in the previous section can also be used to identify the element on the webpage but instead of using the element name directly, we would use the HTML Xpath of the element to identify it and perform automation action on it.


By selecting this option, the bot will send the automation instruction to the 'Automation Script' area with the parameter "UD:ElementName". Unlike in the previous section where we have replaced the whole parameter with the name of the element on the webpage, this time we will replace only the second part of this variable (i.e. will keep the UD: intact) with the user-defined name that we will give to the Xpath of the element.


Please go through these steps to understand in detail -


Step 1 - Copy the XPath of the element of your AUT by right-clicking on the element as shown in the figure.


Step 2 - Add a row in the 'User Defined Element' section. Now open the 'User Defined Elements' section on the right side on the 'Create Bot' tab. Click on the 'Add' button. This will add a row in the table, this is where you have to add the element to the BotPlay's runtime environment.




Step 3 - Add the details of the element. Now give a name to the element by entering it in the 'Name' field, make sure the name is unique. Select 'Type' as Xpath from the dropdown and paste the copied Xpath value in step 1 in the 'Path' field.




Step 4 - Save the element. Click the 'Save' button to save your element. Make sure you get the pop-up to confirm the element is saved.



Step 5 - Use the element in the automation instruction.

(1). Now select the automation action to be performed from the 'Section Actions' section.

(2). Replace the 'ElementName' text in the automation instruction with the user-defined element name we have just created in step 3.

(3). Make sure to keep "UD:" as the prefix to the user-defined element name in the automation instruction. Keeping "UD:" will ensure the bot to know that it has to read the element from the 'User Defined Elements' section and not from the application's UI directly.




5. By the reference of a unique 'neighbour'


This method is helpful when you have multiple elements with the same name. Use this method when -


[The bot is not able to locate the element using the first 2 methods],

AND

[There is a uniquely identifiable neighbour of the element you want to operate on]


For example, in the below screenshot, if the bot is not able to click on the 'Submit' button using the first two methods, and there is a unique element neighbour available, 'Password:' in this case, then this option will let the bot easily identify the element ('Submit' button) using the reference of the neighbour ('Password:' label).



Then we can use this automation action 'automation action by reference' to operate on the final element by letting the bot identifying the unique neighbour element, and then perform automation action on the element which is either before or after. By selecting this option, the bot will send automation instruction to the 'Automation Script' area with two parameters - (1). before/after and (2). ReferenceElement.


Replace the name of the neighbour element in place of the 'ReferenceElement' parameter and select either direction of the element with respect to the selected neighbour between 'before/after'.


In our example as the 'Submit' button is after the 'Password:' label, hence we have used 'after' as the reference direction in the automation instruction. We can use any element of any type as the neighbour.




6. By element's 'index' position on the page


This method is helpful when you have multiple elements with the same name. Use this method when -


[The bot is not able to locate the element using the first 3 methods,]

AND

[There are multiple elements with the same name on the page]


For example, in the below screenshot, there are two elements of the same name 'REGISTER'


Now to handle this case, use the 'automation action by index' option. This will send automation instruction to the 'Automation Script' area with two parameters - (1). ElementName and (2). index.


The 'index' parameter defines the position of the element on the page. In our example in the below screenshot, to click on the second 'REGISTER' button, enter the value as '2' in place of 'index' in the instruction.






This is BotPlay automation a unique codeless automation testing SaaS platform that lets you automate the testing on web applications without writing and maintaining any code.


With BotPlay anyone can automate. Visit botplayautomation.com to download your FREE automation testing bot.



115 views0 comments

Recent Posts

See All
bottom of page