[英]Unable to find an exact match for CDP - Cannot upload a file in SELENIUM & JAVA from windows popup
I'm trying to select a file from a windows pop up in my multi-language page:我正在尝试 select 一个来自 windows 的文件在我的多语言页面中弹出:
My code clicks on 2 buttons until the pop up is shown:我的代码单击 2 个按钮,直到显示弹出窗口:
My CODE:我的代码:
((JavascriptExecutor) driver).executeScript("arguments[0].setAttribute('style','display:block;')", ele);
Thread.sleep(8000);
//driver.findElement(By.xpath("//div[@class='row attachment-files-item']//button[text()='Subir nuevo archivo']")).click();
//Thread.sleep(8000);
driver.findElement(By.xpath("//*[@id=\"div-add-file\"]/a")).click();
Thread.sleep(8000);
driver.switchTo().activeElement().sendKeys("C:\\Users\\steve\\Downloads\\01004185FCA003900517097.pdf");
I am getting this error message:我收到此错误消息:
Unable to find an exact match for CDP version 105, so returning the closest version found: 104
oct. 04, 2022 7:46:10 P. M. org.openqa.selenium.devtools.CdpVersionFinder findNearestMatch
Found CDP implementation for version 105 of 104
Is my code alright?我的代码可以吗? am i doing anything wrong?我做错了什么吗?
The error Unable to find an exact match for CDP version 105, so returning the closest version found: 104
is not associated with the script but its associated with the chrome version
being used错误Unable to find an exact match for CDP version 105, so returning the closest version found: 104
is not associated with the script but its associated with the chrome version
being used
It seems you are using chrome version 105
for that you will have to update the dependencies
for selenium-java
and selenium-devtools-v105
看来您使用的是chrome version 105
,因此您必须更新selenium-java
和selenium-devtools-v105
的dependencies
项
This is highlighted in release notes of selenium 4.5
over here这在此处的selenium 4.5
发行说明中突出显示
Add following dependencies and check if that works fine(Remove older version for the dependency before adding new one)添加以下依赖项并检查它是否正常工作(在添加新依赖项之前删除旧版本的依赖项)
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.5.0</version>
</dependency>
<!--https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-
devtools-v105 -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-devtools-v105</artifactId>
<version>4.5.0</version>
</dependency>
Note:- In case you are using a different version of chrome other than 105
select the corresponding dependency from here for devtools.注意:- 如果您使用的是105
select 以外的其他版本的 chrome,请从此处获取 devtools 的相应依赖项。 Also ensure you are using the correct version of chromed driver as per the current version of chrome installed on your system还要确保您根据系统上安装的当前版本的 chrome 使用正确版本的 chromed 驱动程序
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.