2

I have a few questions around beginning Selenium, Webdrivers and Java and am trying to work out the scope of the task :)

I work for a mainly manual UAT team working in finance (normally input/verify/enquiry data entry screens on web/rumba systems) but have started to learn about test automation. Currently learning QTP / VB at work whenever possible. My background has XHTML, CSS but more than happy to learn about coding, and hopefully I can find an setup which can be shared with both more and less technically able colleagues.

I have looked at the Firefox IDE and understand that you can code in Selense HTML which would be great for some ppl. They can record, edit some regression tests then copy and tweak the data to cater for other scenarios etc.

However our basic hacked together QTP scripts are always data-driven, editing fields, exporting results and screenshots back to Excel etc. which the IDE cant handle; but we are not coders so might struggle with full on Java.

1.) Can code like the below be generated by the IDE (Selense TestCase?) tweaked a little then placed into a generic Java header/footer template taken from the net?

How come the below can look like this rather than normal Java?

This style of code below looks readable enough to be a good middle ground but is more advanced than the IDE.

@Test
public void testOpenTypeClick() throws Exception {
    selenium.open("/");
    selenium.click("link=Advanced search");
    selenium.waitForPageToLoad("30000");
    selenium.type("as_q", "selftechy, selenium");
    selenium.click("//input[@value='Advanced Search']");
    selenium.waitForPageToLoad("30000");
}

public void testSelectCheck() throws Exception {
    selenium.open("http://www.sqajobs.com/");
    selenium.click("link=Advanced Search");
    selenium.waitForPageToLoad("30000");
    selenium.type("bx_jtitle", "Sr. Testing Engineer");
    selenium.select("rdjt", "label=All Of These");
    selenium.removeSelection("jids[]", "label=All Categories");
    selenium.addSelection("jids[]", "label=Functional Testing");
    selenium.type("bx_kwd", "selenium");
    selenium.click("idrdKeyw1");
    selenium.click("id_alltype");
    selenium.check("id_jtp_1");
    selenium.uncheck("id_jtp_1");
    selenium.check("id_jtp_1");
    selenium.click("//input[@name='cmdSearch' and @value='  Search  ']");
    selenium.waitForPageToLoad("30000");
}

2.) How would you setup Selenium to work with code like the below? Can you just access the Client Drivers by coding a link in Eclipse and automate Firefox / IE as I doubt our company would allow the SeleniumServer to run on our PCs.

Appreciate any advice, sorry is the above is unclear as I am very new to coding so lack a strong understanding of terms.

Gav

GavinR
  • 21
  • 1
  • 2

2 Answers2

1

It would make sense to go with Webdriver since it is being actively developed currently. If you have not started then I would suggest you go with a maven project which would help resolve all dependencies you need. Probably this can help : Using Webdriver

If your browser and your tests will run on the same machine, then you need not even have to start a server. Your tests would be as simple as

WebDriver driver = new FirefoxDriver();
driver.get("http://www.google.com");
WebElement element = driver.findElement(By.name("q"));
element.sendKeys("Cheese!");

I would suggest you go through this which would give you a quick getting started overview.

Hope it helps.

niharika_neo
  • 8,441
  • 1
  • 19
  • 31
0

Selenium server is just a jar file and you can place it in your system. Selenium server when configured with Eclipse along with Java client bindings will serve your purpose and if you are using a web based application, you can make the most out of selenium which will be useful for performing your UAT testing.

HemChe
  • 2,249
  • 1
  • 21
  • 33
  • you can go through the below link which will give you a better idea http://seleniumhq.org/docs/05_selenium_rc.html – HemChe Dec 16 '12 at 18:25
  • Thanks HemChe, so I just put a link in the header to call the server when the script runs? And what is the benefit to using the RC server over the standalone WebDriver - guess it supports more as the AP is newer? – GavinR Dec 16 '12 at 23:56
  • Yes. you can use the webdriver. That is the latest one which executes the selenium scripts faster and it has lot many new features compared to selenium RC. Yes, in order to run your selenium RC or webdriver scripts, you need to run the respective server. You can include the RUN command for server in your selenium program itself or you can do it manually. Usually it would be a bettter option to include the START and STOP server code in the selenium RC/webdriver program itself. – HemChe Dec 17 '12 at 05:28