0

I have to test content of webpages . My mentor says to use selenium . I looked up and found it is tool used for testing and thought that 'll do .I tried Selenium IDE and found it repeat our action in web browser. But couldn't understand how to use it as tester.

ToDo : Search of some string in HTML source code of webpage and if they are there in source code then consider the page as ok.

How to do it ? : I have links and source code of webpages and can do string searching in it. Do i need to do it using selenium ? if yes , how ?

Please bear with me if that sound as silly question . I am noob to selenium .

PS : I have to do that in Java.

  • 3
    You should read the documentation for selenium first, try out some code *yourself*, and then post any issue you face. – Manish Jul 06 '12 at 08:41
  • you could try http://htmlunit.sourceforge.net/ – krishnakumarp Jul 06 '12 at 08:45
  • @manish ok . 'll do that for sure. But i was more interested in how to do that i.e which API to use etc . Guidelines only not something like spoon feeding . –  Jul 06 '12 at 08:46

2 Answers2

3

I'm sure this page will help you get started with selenium. http://code.google.com/p/selenium/wiki/GettingStarted

SparedWhisle
  • 1,370
  • 2
  • 10
  • 20
  • Is selenium what i need in my case ? –  Jul 06 '12 at 09:22
  • 1
    Selenium is powerful enough to this, and further, more complex tests. – SparedWhisle Jul 06 '12 at 09:24
  • david Currently I have to check for specific string in specific div block of webpage and have to take screenshot of same. I am using selenium RC for that and I also read this can be done with selenium driver also . Which one should I used or not . –  Jul 12 '12 at 07:47
0

I also recommend http://code.google.com/p/selenium/wiki/GettingStarted

For your tests try following the Arrange, Act, Assert model. This helped make my tests a bit easier to setup.

Arrange the page to your required test state. You could use past tests to do this eg Login, GoToMenuItem, GoToSecondMenuItem.

Act by finding the text you want to find and perform an operation on the website. If you don't need to perform an operation then you don't really need to worry about this step.

Assert by checking the text element still exists on the page. You could use findElement(By.locater)

If you are using Java you could try using JUnit as it makes tests easier to organise. Here is some information on using JUnit with Selenium http://www.codeproject.com/Articles/143430/Test-your-web-application-s-UI-with-JUnit-and-Sele

richardpilgrim
  • 1,270
  • 1
  • 12
  • 15