简体   繁体   English

无法找到 CDP 的完全匹配 - 无法从 windows 弹出窗口上传 SELENIUM 和 JAVA 中的文件

[英]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-javaselenium-devtools-v105dependencies

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.

相关问题 Java-Selenium- 无法找到 CDP 版本 98 的完全匹配,因此返回找到的最接近的版本:97 - Java-Selenium- Unable to find an exact match for CDP version 98, so returning the closest version found: 97 Selenium 连接重置:无法找到 CDP 版本 96 的完全匹配,因此返回找到的最接近的版本:95 - Selenium Connection Reset: Unable to find an exact match for CDP version 96, so returning the closest version found: 95 CdpVersionFinder findNearestMatch 警告:无法找到 CDP 版本 100 的精确匹配项,因此返回找到的最接近的版本:99 和 Selenium - CdpVersionFinder findNearestMatch WARNING: Unable to find an exact match for CDP version 100, so returning the closest version found: 99 with Selenium 警告:无法找到与 CDP 版本 107 完全匹配的版本,因此返回找到的最接近的版本:106 - WARNING: Unable to find an exact match for CDP version 107, so returning the closest version found: 106 无法使用 SELENIUM 和 JAVA 单击按钮 - 触发 windows 弹出窗口上传文件 - Cannot click on a button using SELENIUM and JAVA - triggering windows popup to upload file Selenium:无法从 Intellij 中 Java 项目的本地目录上传文件 - Selenium: Unable to upload a File from the local Directory of Java Project in Intellij 在Mongodb中找不到Java中确切日期匹配的文档 - Unable to find a document in Mongodb where exact date match in java Selenium (Java) - Chrome Headless - 无法上传文件 - Selenium (Java) - Chrome Headless - Unable to upload the file 无法从硒中的 PC 上传 excel 文件 - Unable to upload a excel file from pc in selenium Selenium 4 - 无法使用 java 中的发送键上传视频文件 selenium 4 - Selenium 4 - Unable to upload a video file using send keys in java selenium 4
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM