Tuesday, October 26, 2010

Selenium IDE : Different examples on input

Using the excellent FireFox add-on Firebug and the ubiquitous Google search page, we get this HTML for the "Google Search" button.

There are many ways to code the IDE for this button e.g.

click btnG

click //input[@value='Google Search']

click //input[@type='submit']

click //html/body/span/center/span/center/form/table/tbody/tr/td[2]/span/span/input

The latter ones are examples of XPath and XPath knowledge is VERY useful when coding the IDE scripts.

To get the XPath construct inside Firebug, right click on the HTML segment and then select "Copy XPath".

To check your script without having to run it, load the Click command that you want to test and then select the "Find" button to the right of "Target". The "Google Search" button will be highlighted with a green border if the script works otherwise an error message will be displayed.


No comments: