Quality Testing

Quality is delighting customers

How to test internationalisation through Selenium Webdriver?

I want to test my web application in Japanese language.

Can any one please give an overview on " Handling Internationalisation using selenium webdriver "

Views: 1247

Reply to This

Replies to This Discussion

Madhuri refer below code --

@Test
public void testUntitled() throws Exception {
try {
assertEquals("Salesforce 30 天的免费试用 - Salesforce.com 中国", driver.getTitle());
} catch (Error e) {
verificationErrors.append(e.toString());
}
try {
assertEquals("开始免费试用", driver.findElement(By.cssSelector("a.submit.aloha-submit-mid-blue > span")).getText());
} catch (Error e) {
verificationErrors.append(e.toString());
}
driver.get(baseUrl + "/cn/");
driver.findElement(By.id("free-trial-trigger")).click();
driver.findElement(By.id("UserFirstName")).clear();
driver.findElement(By.id("UserFirstName")).sendKeys("test");
driver.findElement(By.id("UserLastName")).clear();
driver.findElement(By.id("UserLastName")).sendKeys("test");
driver.findElement(By.id("UserTitle")).clear();
driver.findElement(By.id("UserTitle")).sendKeys("test");
driver.findElement(By.id("UserEmail")).clear();
driver.findElement(By.id("UserEmail")).sendKeys("test@gmail.com");
driver.findElement(By.id("UserPhone")).clear();
driver.findElement(By.id("UserPhone")).sendKeys("test");
driver.findElement(By.id("UserPhone")).clear();
driver.findElement(By.id("UserPhone")).sendKeys("test@gmail.com");


driver.findElement(By.id("UserPhone")).clear();
driver.findElement(By.id("UserPhone")).sendKeys("123456789");

driver.findElement(By.id("CompanyName")).clear();
driver.findElement(By.id("CompanyName")).sendKeys("IT");

}

correct me if am wrong means..

refer below url i think this will help full 2 u

http://nileshdk.wordpress.com/2013/08/06/internationalization-autom...

If you want to be able to test multiple products with minimal amount of code, then you should create external class for strings. And test uses that class instead of hard coded string. You don't want to copy paste your test code. Unfortunately I don't have time to show any concrete example which would work. But if you know Java (or program language which you're using), you can create that quite easily. Below is "java style example", but it won't compile:

class MyStrings {
public static String GetTitle() {
switch (language) {
case "Chinese":
return "天的免费试用";
break;
case "English":
return "Title";
break;
}
}
}
}
............
@Test
public void testSomething() {
assertEquals(MyStrings.GetTitle(),driver.getTitle());
....
}

RSS

TTWT Magazine


Advertisement

Advertisement

Advertisement

Advertisement

© 2019   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service