Have you tried with the addresses we discussed last day? What did you find? Let’s discuss two of those
Address 1 : $x(“//div[@class=’columns-container’]”)
Address 3 : $x(“//input[@name=’search_query’]’)
Could you see that the element itself was telling its address? See this in details
Just think, manually what you were doing with a web page. For me it is not more than a two step process:
- Identify the
or of your choice on the webpage
- Perform action on the identified
Automation is no where different from manual steps. The only thing is to instruct the system in its own language.
Consider the example : “I want to search for keyword ‘Dress’ in the application.” Try it, and record the steps you performed manually :
- Launch the Application on Browser
- Identify the search box on the page.
- Provide the keyword ‘Dress’
- Identify the button to perform search action
- Click on the search button
That’s it 🙂 Is it not simple? Yes it is, but all this is manual. Now let’s see, if we have similar instructions in different way
Don’t you remember, this element itself told us its identification,
So note the element, as $x(“//input[@name=’search_query’]’)
Now let’s move to step 4,
It’s your turn now. Try to interact with the ‘Search’ button, using it’s identification.
Now time for some action. We will first convert these five steps into a browser language and then see where it will take us. Launch the Chrome browser, and execute below steps on console window of browser:
I know a few questions that might arise in your mind, but let’s do some practical first, and be amazed.
And now some Assumptions for this day only,
- I assumed browser as ‘document’, and launch the application.
- getElementById is the function, which will find the element on the document with identification value using
- Then is used to supply the value to the target text box
- Again locate the element using identification value using
- and Finally click the element identified in step #4, using method click()
OK, Revise our TWO STEPS fundamental theory of automation,
- Identify the target
- Take the appropriate action
Share your experience of this learning through comments, and suggest how the learning can be improved 🙂