Reputation: 9
i am using selenium page object model below is the problem scenario i am clicking on an element using below command
driver.findElement(By.xpath("xxxxxxxx")).click();
when code execute the above line , click has been performed in the browser and a new page starts loading but code stuck at the above line untill the whole page loads. i am not able to perform any operation on any webelemnet untill the page loads completely. below is the code:
WebElement element = driver.findElement(By.xpath(".//*[@id='lll-menu-1']/div[1]/ul/li[4]/a"));
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", element);after this line code stuck here until the page loads completely
WebElement elem = driver.findElement(By.xpath(".//img[@alt='Cool Racerback - regular']"));
elem.click();
Upvotes: 0
Views: 928
Reputation: 450
I don't think it is possible, you have to just wait for the page to load as this is built into webdriver.
Upvotes: 0
Reputation: 2444
You can try with:
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("YOUR ELEMENT XPATH")));
Upvotes: 0