Issue
1trying to execute the below code
I was writing script where I used mouse hover code to click on join and then it would show membership screen with 3 different panels, I wrote code to click "join button" on free panel, but this isnt working as there is a window popup showing up and not letting the code run. please help
System.setProperty("webdriver.chrome.driver","C:\\Selenium\\Drivers\\chromedriver_win32\\chromedriver.exe");
WebDriver driver= new ChromeDriver();
driver.get("https://www.nvidia.com/en-us/geforce-now/");
Thread.sleep(3500);
Actions ac= new Actions(driver);
ac.moveToElement(driver.findElement(By.linkText("Join Now"))).perform();
driver.findElement(By.xpath("/html/body/div[1]/div/div[11]/section/div/div/div/div/div[1]/div/div/div/section/div/div[1]/a/div[2]/div[3]/div/div/button")).click();
driver.close();
Getting the exception :
Exception in thread "main" org.openqa.selenium.ElementClickInterceptedException: element click intercepted: Element ... is not clickable at point (259, 649). Other element would receive the click: ...
Solution
You can use the JavascriptExecutor class to do this. Assuming that even if we don't close the window popup we are still able to proceed, this should solve your issue This method of clicking sends the click event directly to Element.
// Assume driver is a valid WebDriver instance that
// has been properly instantiated elsewhere.
WebElement element = driver.findElement(By.id("elementiD"));
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", element);
Answered By - nika65
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.