Sign up in 30 seconds.
No credit card.
No risk.
No download.
Testing web sites with Selenium
Selenium provides an open source
software testing framework that is ideal for web-based applications
and sites. Developers can write the tests in the form of HTML tables
or can code them in any popular programming language. Moreover, Selenium
can be deployed on any of the modern web browsers to test web site performance.
Selenium has a Firefox extension for test case recording and editing
in IDE (Integrated Development Environment). Developers can deploy Selenium
on Macintosh, Linux or Windows.
Software Testing Tips Using
Selenium
- For setting variables,
it is preferable to use storedVars['x'] rather than ${x}. Although,
${x} is shorter, it does not identify the real value and cannot be assigned
anything. storedVars['x'] represents stored user variables of Selenium
and is the best to use. - You should adopt
storeEval to run a Javascript code to define functions in Selenium IDE.
You can store the result in a variable that you can make use of for
proceeding commands. - Use the ‘assert’
command rather than ‘verify.’ The ‘verify’ command in Selenium
will allow the test case to run, but will fail at the end. In case of
the ‘assert’ command, the test will stop. - You can use captureEntirePageScreenShot
command of Selenium, as it works perfectly with IDE/HTML. You could
use this command for critical scenarios, such as for issue debugging
in case you schedule test suites. However, it may not work well with
the Java programming language. In this case, you can try the capturescreenshot
command. - If you wish to keep
the test case in ‘HTML,’ you should ideally write a wrapper in .net/jsp
for the test case. - When you notice
problems occurring while recording in Firefox, disable Selenium IDE
and enable it again. To do this, click on Tools->Add on -> Selenium
IDE. Ensure that you restart the browser after that. - In case the browser
does not get killed automatically, consider killing it manually. - You may need to
use lots of xpath in your test and Firebug allows you to get xpath by
right clicking on the element. From the context menu choose "Copy
Xpath" and paste it. You may be required to replace "/html/body/"
with "//".
Comments
Hi, about For setting
Hi,
about For setting variables,
it is preferable to use storedVars['x'] rather than ${x}. Although,
${x} is shorter, it does not identify the real value and cannot be assigned
anything. storedVars['x'] represents stored user variables of Selenium
and is the best to use.
Can you detail this assertion?
Why ${x} does not identify the real value? I use a lot of variables in Selenium IDE, and I don't understand why they 'did not identify'.
Why ${x} cannot be assigned anything?
Thank you in advance.