how to give wait to driver.get(), because the URL we are visiting using .get() is dont know. and may take unkown time so is we have to give 30seconds timeout to diver.get() then how to give it.
following is the code for it..
package org.openqa.selenium.example;
import java.util.List;
import org.openqa.selenium.By
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class MyClass{
public static void main(String[] args) throws Exception {
// The Firefox driver supports javascript
WebDriver driver = new HtmlUnitDriver();
// Go to the some websites
driver.get("http://www.abced.com/123456/asd.htm");
/*** Here we DONT get back the driver, so we need to Give Time out of 30 seconds**/
final List<WebElement> element1= driver.findElements(By.tagName("a"));
for (WebElement webElement : element1) {
String urlFromPage = webElement.getAttribute("href");
System.out.println(urlFromPage);
}
}
}
I tried
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.get(thisPage.url);
It is not working.. plz suggest, tx