Open lukeis opened 8 years ago
Try to wait for the element to become visible before click:
WebElement iagree = new WebDriverWait(driver, 10).until(
ExpectedConditions.visibilityOfElementLocated(By.cssSelector(".termsInput")));
iagree.click();
Reported by barancev
on 2011-11-16 20:58:30
NeedsClarification
Reported by barancev
on 2011-11-16 20:58:51
Thanks for your tip. Unfortunately, I am still getting the same error with the same
stack trace.
Reported by atiq.rahman
on 2011-11-17 00:25:29
OK, reproduced on WinXP with IE7. At the same time, IE9 on Win7 works as expected. Need
to check other IE versions.
Repro scenario:
import java.net.URL;
import java.util.List;
import java.util.concurrent.TimeUnit;
import junit.framework.Assert;
import org.junit.Test;
import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.Capabilities;
import org.openqa.selenium.SeleneseCommandExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.support.ui.Select;
import com.opera.core.systems.OperaDriver;
public class Bug2857 {
public static void main(String[] args) throws Exception {
WebDriver driver = new InternetExplorerDriver();
driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
driver.get("https://qaone.v112test.ezrez.com/travel/arc_waiting.cfm?origin=%2Ftravel%2Farc.cfm%3Ftab%3Dr&room1=true&area2_display=HNL&area2=HNL&date1=12%2F28%2F11&date2=12%2F29%2F11&num_rooms=1&adults=1&child_age1=-1&child_age2=-1&child_age3=-1");
List<WebElement> hotels = driver.findElements(By.className("hotelOption"));
hotels.get(4).findElement(By.className("card_link")).findElement(By.tagName("a")).click();
driver.findElement(By.className("roomPrice")).findElement(By.className("submit_link")).findElement(By.tagName("a")).click();
driver.findElement(By.className("submit_link")).click();
driver.findElement(By.className("submit_link")).click();
WebElement iagree = driver.findElement(By.cssSelector(".termsInput"));
Assert.assertFalse(iagree.isSelected());
iagree.click();
Assert.assertTrue(iagree.isSelected());
}
}
Reported by barancev
on 2011-11-17 07:53:03
Accepted
Sorry for getting back so late since I was out on vacation...Anyways, thanks for the
code solution above but for some reason it did not work for me.
However, what did work for me was the JavascriptExecutor work around below just before
the click(). This work like a magic.
((JavascriptExecutor) webDriver).executeScript("window.scrollTo(0,document.body.scrollHeight);");
Reported by atiq.rahman
on 2011-12-08 23:11:31
Reported by luke.semerau
on 2015-09-17 17:44:26
Originally reported on Google Code with ID 2857
Reported by
atiq.rahman
on 2011-11-16 19:47:23