Hello all I am using webdriver so if I want to use selenium;s rc function isElementPresent I have to emulate selenium rc so I do something like this:
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverBackedSelenium;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class new {
private static void one_sec() {
Thread.sleep(4000);
}
public static void main(String[] args) {
WebDriver driver = new FirefoxDriver();
driver.get(something1);
Selenium selenium = new WebDriverBackedSelenium(driver, something1);
selenium.click("//html...");
one_sec();
System.out.println(selenium.isElementPresent("text"));
WebDriver driverInstance = ((WebDriverBackedSelenium) selenium).getWrappedDriver();
...
}
and I always get false as result of isElementPresent and of course element "text" is on the web (which is using GWT).
IsElementPresent Method. Verifies that the specified element is somewhere on the page.
Implicit Wait directs the Selenium WebDriver to wait for a certain measure of time before throwing an exception. Once this time is set, WebDriver will wait for the element before the exception occurs. Once the command is in place, Implicit Wait stays in place for the entire duration for which the browser is open.
I really like Rostislav Matl's alternative Moving to Selenium 2 on WebDriver, Part No.1:
driver.findElements(By.className("someclass")).size() > 0;
Javadoc: org.openqa.selenium.WebDriver.findElements(org.openqa.selenium.By by)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With