Webdriver seems to not able to pick webelement
(button) on a page which it located initially but coming back to same page on traversing multiple pages, same object doesn't get located by selenium webdriver
.
Situation is like, I'm at home page and verified it by adding .isDisplayed()
method like this-
if (isElementPresent("(//input[@name='sbqq__editlines'])[1]") == true)
{
System.out.println("YES, reached on Quote page");
if (objApprovalBlk.findElement(By.xpath(".//table[@class='list']")).isDisplayed())
{
List<WebElement> rows = objApprovalBlk.findElement(By.xpath(".//table[@class='list']")).findElements(By.xpath(".//tr"));
List<WebElement> rows = objApprovalBlk.findElement(By.xpath(".//table[@class='list']")).findElements(By.xpath(".//tr"));
...now if rows are present with text 'Requested' then a link has to be clicked on that row and workflow takes the user to multiple page of Apporval !
driver.findElement(By.xpath("//input[@value='Approve']")).click();
///Reaching back to QUOTE page now ! ---NOT WORKING FROM HERE !
tmpElement = new WebDriverWait(driver, 100)
.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@name='sbqq__editlines'])[1]")));
tmpElement = null;
}else{
System.out.println("Didn't reached Quote Page !");
}
So,on reaching back to home page, same object //input[@name='sbqq__editlines'])[1]
is not identifiable. Following is the exception I'm receiving :
org.openqa.selenium.TimeoutException: Timed out after 100 seconds waiting for element to be clickable: By.xpath: //input[@name='sbqq__editlines'])[1]
I'm not able to understand the issue behind this, does driver referring a stale object or when I clicked the link on Quote home page, it was not from driver object directly but something else and hence I might need to refresh driver object. I've just started with selenium
while coming from HP UFT
background hence that thought of refreshing object was my first assessment of the issue.