1
driver.findElement(By.id("oPortalUser_LoginID")).sendKeys("xxxxx");

driver.findElement(By.id("oPortalUser_Password")).sendKeys("xx");

driver.findElement(By.id("xxx")).click();

After clicking on Login button, it takes lot of time to load. So am not able to identify an element from the next line.

Thread.sleep(2000);

driver.findElement(By.xpath("//div[@id='LftNav']/ul/li[7]/a")).click();

I have tried implicit and explicit waits. But its not working every time.

2 Answers 2

1

Checkout this link:
https://stackoverflow.com/questions/978740/javascript-how-to-detect-if-document-has-loaded-ie-7-firefox-3
You can use javascript to check if the document has loaded or not, and can perform your actions accordingly.

1
0

if u tried with Implicit and Explicit wait last try with below code you might get success.

Thread.sleep(1000);

or

WebDriverWait wait = new WebDriverWait(driver, 15);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//input[@id='text3']")));
8
  • I have tried sleeping methods but when the load is more, it takes more time and the script fails. So I need an alternative solution without using implicit and explicit waits. @sameer joshi
    – kripindas
    Commented Oct 5, 2015 at 5:49
  • increase more in miliseconds of thread.sleep method Commented Oct 5, 2015 at 5:51
  • i have tried it but it does not work correctly in the time where load in the website is high.@sameer joshi
    – kripindas
    Commented Oct 5, 2015 at 5:52
  • check my comment Commented Oct 5, 2015 at 5:57
  • I have tried both of this. It is working but it not working everytime.
    – kripindas
    Commented Oct 5, 2015 at 5:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.