Ниже приведен код, который я выполняю, и после входа на страницу я пытаюсь нажать кнопку «Депозит» на левой боковой вертикальной панели навигации. Но перед кнопкой «Депозит» отображается видеообъявление, которое находится внутри рамки. В моей программе я пытаюсь закрыть объявление из фрейма и вернуться на главную страницу, чтобы компилятор увидел кнопку «Депозит», а после этого просто пытаюсь нажать кнопку «Депозит». Ниже приведена программа, которую я пробую.
Может кто-нибудь помочь мне с тем, как будет нажиматься кнопка «Депозит»
package SeleniumSessions;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class TestGuru99PopUp {
public static void main(String[] args) throws InterruptedException {
System.setProperty("webdriver.chrome.driver","F:\\Drivers\\chromedriver_win32\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
//alert.dismiss();// this is used to cancel the alert
driver.manage().window().maximize();
driver.manage().deleteAllCookies();
driver.manage().timeouts().pageLoadTimeout(40, TimeUnit.SECONDS);
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.get("http://demo.guru99.com/V4/");
driver.findElement(By.xpath("//input[@name = 'uid']")).sendKeys("username");
driver.findElement(By.xpath("//input[@name = 'password']")).sendKeys("password");
driver.findElement(By.xpath("//input[@name = 'btnLogin']")).click();
Thread.sleep(5000);
/*JavascriptExecutor jse = (JavascriptExecutor)driver;
jse.executeScript("window.scrollBy(0,250)");*/
//driver.switchTo().frame("flow_close_btn_iframe");
driver.switchTo().frame(driver.findElement(By.cssSelector("iframe[title='Flow Close Button']")));
Boolean frameClose = driver.findElement(By.xpath("//div[@id = 'closeBtn']")).isDisplayed();
System.out.println(frameClose);
driver.findElement(By.xpath("//div[@id = 'closeBtn']")).click();
driver.switchTo().defaultContent();
//Thread.sleep(1000);
driver.findElement(By.xpath("//a[contains(text(),'Deposit')]")).click();
System.out.println("program reached end successfully");
driver.quit();
// TODO Auto-generated method stub
// TODO Auto-generated method stub
}
}
**** Ниже приведена ошибка, которой я являюсь получение в консоли. ****
Starting ChromeDriver 80.0.3987.106 (f68069574609230cf9b635cd784cfb1bf81bb53a-refs/branch-heads/3987@{#882}) on port 32445
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
[1587964475.823][WARNING]: This version of ChromeDriver has not been tested with Chrome version 81.
[1587964477.868][WARNING]: Timed out connecting to Chrome, retrying...
Apr 27, 2020 10:44:40 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
[1587964482.639][WARNING]: Timed out connecting to Chrome, retrying...
[1587964486.584][SEVERE]: Timed out receiving message from renderer: 0.100
[1587964486.691][SEVERE]: Timed out receiving message from renderer: 0.100
[1587964486.799][SEVERE]: Timed out receiving message from renderer: 0.100
[1587964486.912][SEVERE]: Timed out receiving message from renderer: 0.100
[1587964487.017][SEVERE]: Timed out receiving message from renderer: 0.100
[1587964487.168][SEVERE]: Timed out receiving message from renderer: 0.100
[1587964487.271][SEVERE]: Timed out receiving message from renderer: 0.100
[1587964487.375][SEVERE]: Timed out receiving message from renderer: 0.100
[1587964487.559][SEVERE]: Timed out receiving message from renderer: 0.100
[1587964487.664][SEVERE]: Timed out receiving message from renderer: 0.100
[1587964487.767][SEVERE]: Timed out receiving message from renderer: 0.100
[1587964487.964][SEVERE]: Timed out receiving message from renderer: 0.100
[1587964488.073][SEVERE]: Timed out receiving message from renderer: 0.100
[1587964489.291][SEVERE]: Timed out receiving message from renderer: 0.100
[1587964489.673][SEVERE]: Timed out receiving message from renderer: 0.100
[1587964489.784][SEVERE]: Timed out receiving message from renderer: 0.100
[1587964489.900][SEVERE]: Timed out receiving message from renderer: 0.100
[1587964490.065][SEVERE]: Timed out receiving message from renderer: 0.100
[1587964490.168][SEVERE]: Timed out receiving message from renderer: 0.100
[1587964490.397][SEVERE]: Timed out receiving message from renderer: 0.100
[1587964490.535][SEVERE]: Timed out receiving message from renderer: 0.100
[1587964490.638][SEVERE]: Timed out receiving message from renderer: 0.100
[1587964493.468][SEVERE]: Timed out receiving message from renderer: 0.100
[1587964494.149][SEVERE]: Timed out receiving message from renderer: 0.100
[1587964494.487][SEVERE]: Timed out receiving message from renderer: 0.100
[1587964494.590][SEVERE]: Timed out receiving message from renderer: 0.100
[1587964494.696][SEVERE]: Timed out receiving message from renderer: 0.100
[1587964494.799][SEVERE]: Timed out receiving message from renderer: 0.100
true
Exception in thread "main" org.openqa.selenium.ElementClickInterceptedException: element click intercepted: Element <a href="...Input.php">Deposit</a> is not clickable at point (120, 569). Other element would receive the click: <div id="primis_container_div">...</div>
(Session info: chrome=81.0.4044.122)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'
System info: host: 'DESKTOP-1QASA0A', ip: '192.168.1.129', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '14'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 81.0.4044.122, chrome: {chromedriverVersion: 80.0.3987.106 (f68069574609..., userDataDir: C:\Users\Ravindra\AppData\L...}, goog:chromeOptions: {debuggerAddress: localhost:55201}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
Session ID: d2ff228f926b8de0b294c01581896a4f
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:285)
at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:84)
at SeleniumSessions.TestGuru99PopUp.main(TestGuru99PopUp.java:45)
Ниже приведены два тега iframe (один для кнопки закрытия видео и один для всего видео) и тег div, внутри которого присутствует iframe.
<iframe id="flow_close_btn_iframe" title="Flow Close Button" scrolling="no" style="border: none; position: fixed; display: block; background-color: rgba(255, 255, 255, 0); left: 305px; z-index: 2147483646; width: 21px; height: 21px; bottom: 187px;"></iframe>
<iframe id="primis_playerSekindoSPlayer5ea66ddeb2386" title="Primis Player Videos" scrolling="no" allowfullscreen="" style="border: none; position: fixed; bottom: 10px; width: 315px; height: 177px; box-shadow: rgba(0, 0, 0, 0.4) 1px 1px 6px 3px; border-radius: 1px; z-index: 2147483646; left: 10px;"></iframe>
<div id="primis_container_div"><iframe id="flow_close_btn_iframe" title="Flow Close Button" scrolling="no" style="border: none; position: fixed; display: none; background-color: rgba(255, 255, 255, 0); left: 577px; z-index: 2147483646; width: 21px; height: 21px; bottom: 187px;"></iframe><div id="placeHolder" style="position: relative; overflow: hidden; width: 0px; height: 0px;"><img src="https://live.sekindo.com/content/video/splayer/assets/placeHolder.png" alt="Primis Player Placeholder" style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: auto; height: 100%;"></div><iframe id="primis_playerSekindoSPlayer5ea66ddeb2386" title="Primis Player Videos" scrolling="no" allowfullscreen="" style="border: none; position: relative; width: 300px; height: 169px; border-radius: 0px; z-index: 0;"></iframe></div>