I want to automate a website with selenium web driver using javascript. I am good at Junit
(java) but not an expert in JavaScript.
Please, can anyone help me rewrite this little code snippet in JavaScript to make some comparison:
import com.thoughtworks.selenium.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
import java.util.regex.Pattern;
public class Konga_Test1 {
private Selenium selenium;
@Before
public void setUp() throws Exception {
selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://www.konga.com/nefertiti");
selenium.start();
}
@Test
public void testKonga_Test1() throws Exception {
selenium.open("http://www.konga.com/nefertiti");
selenium.click("//button[@type='button']");
selenium.waitForPageToLoad("30000");
verifyEquals("Shopping Cart", selenium.getText("css=h1"));
verifyTrue(selenium.isTextPresent("Frosted Chocotastic Pop tarts"));
verifyTrue(selenium.isTextPresent("₦2,100"));
selenium.goBack();
selenium.waitForPageToLoad("30000");
verifyTrue(selenium.isTextPresent("₦2,100"));
String vPrd = selenium.getText("css=#product-price-1091495 > span.price");
System.out.println("Value is " + vPrd);
}
private void verifyTrue(boolean textPresent) {
// TODO Auto-generated method stub
}
private void verifyEquals(String string, String text) {
// TODO Auto-generated method stub
}
@After
public void tearDown() throws Exception {
// selenium.stop();
}
}