【java – 如何关闭Chrome浏览器弹出窗口?】教程文章相关的互联网学习教程文章

java-使用Selenium在Chrome浏览器中保存文档【代码】

我有一个Selenium(Java)测试应用程序,该应用程序在浏览器中打开pdf文档,并将其保存到硬盘驱动器中,以供稍后在测试中使用.由于将要在多台计算机上使用该测试,因此无法手动设置配置文件.它必须以编程方式完成. 在Firefox中,我设置了配置文件首选项:FirefoxProfile profile = new FirefoxProfile();profile.setPreference("browser.download.manager.showWhenStarting", false);profile.setPreference("browser.download.dir", appSe...

java-Selenium Chromedriver服务器超时,尽管可用【代码】

我有一个Java Selenium项目,该项目不会在我的计算机上运行,??但会在具有相同OS版本(OSX 10.13.1),Chrome浏览器版本(63.0.3239.84)和chromedriver版本(2.34)的同事的计算机上运行.我收到消息:Starting ChromeDriver 2.34.522932 (4140ab217e1ca1bec0c4b4d1b148f3361eb3a03e) on port 18633 Only local connections are allowed.org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start. Build info...

java-向Selenium2(WebDriver)chrome驱动程序添加扩展【代码】

我正在使用下面的代码使用webdriver(硒2)启动chromeMap<String, String> mobileEmulation = new HashMap<String, String>();mobileEmulation.put("deviceName", "BlackBerry PlayBook");Map<String, Object> chromeOptions = new HashMap<String, Object>();chromeOptions.put("mobileEmulation", mobileEmulation);DesiredCapabilities capabilities = DesiredCapabilities.chrome();capabilities.setCapability(ChromeOptions.CA...

Java-Selenium sendKeys()对于Chrome,Firefox和Safari的不同行为【代码】

以下是简单的代码段.@FindBy(className = "element-to-press") private WebElement elementToPress;// some other codeKeys move = Keys.ARROW_DOWN; gridContainer.sendKeys(move);在Firefox中,一切正常. 在Chrome浏览器中,我收到“ org.openqa.selenium.WebDriverException:未知错误:无法聚焦元素”错误 Safari不响应sendKeys() 我也尝试使用另一种方法:Keys move = Keys.ARROW_DOWN; Actions actions = new Actions(driver);...

Java-Chromecast Sender v2.7.0锁屏图像【代码】

我们如何显示运行v2.7.0的chromecast发送器应用的锁屏插图.我花了大约2天的最好的时间来解决这个问题. v2.7.0库当前在VideoCastManager.java类中具有以下方法:private void setBitmapForLockScreen(MediaInfo video) {if (video == null || mMediaSessionCompat == null) {return;}Uri imgUrl = null;Bitmap bm = null;List<WebImage> images = video.getMetadata().getImages();if (Build.VERSION.SDK_INT > Build.VERSION_CODES...

java-用硒运行无头Chrome【代码】

System.setProperty("webdriver.chrome.driver", "/usr/bin/google-chrome");final ChromeOptions chromeOptions = new ChromeOptions();//chromeOptions.addArguments("headless");chromeOptions.addArguments("window-size=1200x600");final DesiredCapabilities desiredCapabilities = new DesiredCapabilities();desiredCapabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);final URL url = new URL("https:...

java – Selenium ChromeDriver:增加获取WebElement Text的时间【代码】

我有一个代码,我遍历表行和列,我想将它的值添加到列表中. 这花了我很多时间. 所以我添加了时间测量,我注意到由于某种原因,时间从一行到另一行增加. 我不明白为什么. 你能告诉我吗?private void buildTableDataMap() {WebElement table = chromeWebDriver.findElement(By.id("table-type-1"));List<WebElement> rows = table.findElements(By.tagName("tr"));theMap.getInstance().clear();String item;for (WebElement row : rows...

java – Chrome由自动化测试软件控制【代码】

我正在使用Serenity BDD(Selenium)在Chrome中运行自动化测试. 我不得不下载新的ChromeDriver,因为我的测试无法运行 – >该测试将打开ChromeDriver,但无法“以用户身份浏览”.当我搜索问题时,他们说我必须更新ChromeDriver. 所以我将ChromeDriver更新到版本2.28,我还将Chrome版本更新为版本57.0.2987.98. 但现在 – 每次我运行测试时都会出现这个烦人的文字:Chrome is being controlled by automated test software它问我是否要保存...

java – 将选项传递给chrome驱动程序selenium【代码】

我试图禁用输出到控制台的chrome.如果我通过–start-maximized选项,它可以正常工作.我可能有错误的命令?DesiredCapabilities capabilities = DesiredCapabilities.chrome(); capabilities.setCapability("chrome.switches", Arrays.asList("--silent")); chrome = new ChromeDriver(_chromeservice,capabilities);我也试过了ChromeOptions options = new ChromeOptions();options.addArguments("silent");chrome = new ChromeDriv...

是否可以使用Java构建Chrome扩展?

是否可以使用Java而不是JavaScript构建Chrome扩展? (我在Eclipse IDE中使用Java SE.)解决方法:Chrome扩展程序必须运行JavaScript.但是,您可以使用Google Web Toolkit将Java编译为JavaScript.

java – org.openqa.selenium.WebDriverException:chrome无法访问 – 尝试启动新会话时【代码】

当我在Chrome上运行测试时,我经常会遇到无法访问Chrome的WebdriverException.它不会每次都发生.也许每15次一次.我不得不在Windows机器上运行所有东西,我有最新的Chrome,Chromedriver,Selenium-Webdriver版本. 我已经尝试设置环境变量“DBUS_SESSION_BUS_ADDRESS = / dev / null”.根本没有帮助. 任何人遇到这个并找到了解决方案?org.openqa.selenium.WebDriverException: chrome not reachable(Driver info: chromedriver=2.35.52...

java – ChromeDriver(功能功能)已弃用【代码】

我将ChromeDriver 2.33与WebDriver 3.6.0一起使用,并尝试设置文件下载的默认目录.Map<String, Object> prefs = new HashMap<String, Object>(); prefs.put("download.default_directory", Vars.DOWNLOAD_FOLDER_ROOT); DesiredCapabilities caps = DesiredCapabilities.chrome();ChromeOptions options = new ChromeOptions(); options.addArguments("--start-maximized"); options.setExperimentalOption("prefs", prefs); caps.s...

Java Selenium Chromedriver.exe不存在IllegalStateException【代码】

这是我收到的错误消息:Exception in thread "main" java.lang.IllegalStateException: The driver executable does not exist: C:\Users\Scott\workspace\Twitch%20Bot%20v2\bin\chromedriver.exeat com.google.common.base.Preconditions.checkState(Preconditions.java:197)at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:122)at org.openqa.selenium.remote.service.DriverService....

java – Chrome错误:您使用的是不受支持的命令行标志: – ignore-certifcate-errors.稳定性和安全性将受到影响

浏览器打开时带有下面提到的行 – You are using an unsupported command-line flag: –ignore-certifcate-errors. Stability and security will suffer.以及几秒后浏览器关闭并抛出错误. 我在chrome上运行代码时遇到上述错误. 我正在使用chrome版本–44.0.2403.155和最新的selenium jar. 有人可以帮帮我吗?解决方法:对于版本为58.0.3029.110的Chrome版本,您应该使用2.2.8版本的Chrome.driver.然后,您不会收到错误“您正在使用不受...

获取无法使用java / selenium将元素集中在chrome和edge中【代码】

我在chrome中运行我的测试并在FF中获得了一个无法聚焦元素错误它工作正常.我已尝试过发布的决议但无济于事.我不知道该怎么做.希望有人可以提供帮助.提前致谢.driver.findElement(By.linkText("Add")).click(); List <WebElement> groups = new Select(driver.findElement(By.xpath("/html/body/div[1]/section/div/article/form/fieldset/div[3]/div[2]/div/div/div[1]/select"))).getOptions(); groups.get(3).click(); Javascrip...

窗口 - 相关标签