@Override public void click(String locator) { selenium.click(locator); }
public void click(String locator) { base.click(locator); }
public void click(String locator) { sel.click(locator); }
public void click(String locator) { selenium.click(locator); }
public void click(String locator) { selenium.click(locator); }
@Override public void click(ElementLocator<?> elementLocator) { selenium.click(elementLocator.inSeleniumRepresentation()); }
public class BackedWebdriver { public static WebDriver driver; public static String baseUrl; public static Selenium selenium; public static void main(String[] args) { driver = new FirefoxDriver(); //Here we are mentioning that we will use Firefox browser baseUrl = "http://www.google.co.in/"; driver.get(baseUrl); selenium = new WebDriverBackedSelenium(driver, baseUrl); selenium.windowMaximize(); driver.findElement(By.id("gbqfq")).clear(); driver.findElement(By.id("gbqfq")).sendKeys("selenium"); selenium.click("g"); driver.findElement(By.id("gbqfb")).click(); }
Selenium selenium = new DefaultSelenium("localhost", 4444, "*firefox", BASE_URL); selenium.start(); selenium.open(BASE_URL); selenium.type("j_idt8:inputName", "Robot"); selenium.click("j_idt8:_t12"); selenium.waitForCondiditon("selenium.isElementPresent('j_idt17:input')", MAX_WAIT_TIME_IN_MS); selenium.type("j_idt17:input", "Selenium testing in proggress...."); selenium.click("j_idt17:_t20"); selenium.waitForCondiditon("selenium.isElementPresent('j_idt17:input')", MAX_WAIT_TIME_IN_MS); selenium.type("j_idt17:input", "Test over!"); selenium.click("j_idt17:_t20"); selenium.stop();
Selenium selenium = new DefaultSelenium(host, port, browser, baseurl); selenium.get(urlPath); selenium.type(username_field, username); selenium.type(password_field, password); selenium.click(login_button);
private void clickAndWait(String s) { selenium.click(s); selenium.waitForPageToLoad("5000"); }
Selenium selenium=new DefaultSelenium("localhost", 4444 , "*firefox","myurl"); selenium.start(); selenium.open("myurl"); System.out.println("Open browser "+selenium); selenium.windowMaximize(); selenium.type("id=j_username","Lal"); selenium.type("name=j_password","lal"); selenium.click("name=submit"); **selenium.waitForPageToLoad("60000");** if(selenium.isTextPresent("Lal")) { selenium.click("id=common_header_logout"); } else { System.out.println("User not found"); }
public class TestBase { protected WebDriver driver; protected Selenium selenium @Before public void setUp() throws Exception { driver = new FirefoxDriver(); String baseUrl = "http://trn-test-web.fon.com/"; selenium = new WebDriverBackedSelenium(driver, baseUrl); } @Test public void firstTest() throws Exception{ selenium.open("/opencase/login.seam"); selenium.type("//input[contains(@id, ':username')]", "admin"); selenium.type("//input[contains(@id,':mypassword')]", "admin"); selenium.click("//a[contains(@id,'loginForm:')]/span"); selenium.waitForPageToLoad("60000"); _wait("Home", "id=oc-title-id"); }
import com.thoughtworks.selenium.DefaultSelenium; import com.thoughtworks.selenium.Selenium; public class TestRun { public static void main(String[] args) { Selenium selenium=new DefaultSelenium("localhost", 4444 , "*firefox","myurl"); selenium.start(); selenium.open("myurl"); System.out.println("Open browser "+selenium); selenium.windowMaximize(); selenium.type("id=j_username","Lal"); selenium.type("name=j_password","lal"); selenium.click("name=submit"); **selenium.waitForPageToLoad("60000");** if(selenium.isTextPresent("Lal")) { selenium.click("id=common_header_logout"); } else { System.out.println("User not found"); } } }
/** * @see org.testatoo.core.Evaluator */ @Override public void click(Component component, Click which) { try { setFocus(component); if (which == Click.right) { evaljQuery("$('#" + component.id() + "').simulate('rightclick')"); } else { // If component is link we need to open the expected target // Not sure but some Browser seems have a security check to not open page on js event if (component instanceof Link && !((Link) component).reference().equals("#")) { selenium.click(component.id()); } else { evaljQuery("$('#" + component.id() + "').simulate('click')"); } } } catch (Exception e) { // Continue... if the click change page } }
browser.click("btnG");