GVKun编程网logo

org.openqa.selenium.WebDriverException:未知错误:调用函数结果缺少“值”(调用函数出现不可知错误)

13

如果您对org.openqa.selenium.WebDriverException:未知错误:调用函数结果缺少“值”和调用函数出现不可知错误感兴趣,那么这篇文章一定是您不可错过的。我们将详细讲解or

如果您对org.openqa.selenium.WebDriverException:未知错误:调用函数结果缺少“值”调用函数出现不可知错误感兴趣,那么这篇文章一定是您不可错过的。我们将详细讲解org.openqa.selenium.WebDriverException:未知错误:调用函数结果缺少“值”的各种细节,并对调用函数出现不可知错误进行深入的分析,此外还有关于Chrome-org.openqa.selenium.WebDriverException:未知错误:无法在driver.manage()window()maximize();处获得自动化扩展、Chrome-org.openqa.selenium.WebDriverException:未知错误:无法在driver.manage()。window()。maximize();处获得自动化扩展、Chrome浏览器中的Selenium在线程“main”org.openqa.selenium.WebDriverException中显示异常:等待驱动程序服务器启动超时、org.openqa.selenium.ElementNotVisibleException:通过SeleniumWebDriver和Java单击复选框时,元素当前不可见的实用技巧。

本文目录一览:

org.openqa.selenium.WebDriverException:未知错误:调用函数结果缺少“值”(调用函数出现不可知错误)

org.openqa.selenium.WebDriverException:未知错误:调用函数结果缺少“值”(调用函数出现不可知错误)

Sendkeys不起作用。请帮我解决这个问题。

WebElement username = driver.findElement(By.xpath("//*[@id=''username'']"));      username.sendKeys("123456");

安慰:

Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: call function result missing ''value''  (Session info: chrome=65.0.3325.31)  (Driver info: chromedriver=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT 6.1.7601 SP1 x86) (WARNING: The server did not provide any stacktrace information)Command duration or timeout: 0 millisecondsBuild info: version: ''3.8.1'', revision: ''6e95a6684b'', time: ''2017-12-01T19:05:32.194Z''System info: host: ''NEW-PC'', ip: ''192.168.0.103'', os.name: ''Windows 7'', os.arch: ''x86'', os.version: ''6.1'', java.version: ''1.8.0_161''

驾驶员信息:

org.openqa.selenium.chrome.ChromeDriverCapabilities {acceptSslCerts: true, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {chromedriverVersion: 2.33.506120 (e3e53437346286..., userDataDir: C:\Users\NEW\AppData\Local\...}, cssSelectorsEnabled: true, databaseEnabled: false, handlesAlerts: true, hasTouchScreen: false, javascriptEnabled: true, locationContextEnabled: true, mobileEmulationEnabled: false, nativeEvents: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, rotatable: false, setWindowRect: true, takesHeapSnapshot: true, takesScreenshot: true, unexpectedAlertBehaviour: , unhandledPromptBehavior: , version: 65.0.3325.31, webStorageEnabled: true}

答案1

小编典典

我看到了同样的问题。仅在使用Chrome 65(当前:开发人员通道)时出现此问题。使用Chrome 64(稳定通道和Beta通道),一切正常。

原来我安装了旧的chromedriver。具体来说,我用chrome=65.0.3325.51chromedriver=2.29.461585。将npminstall -g chromedriver撞色的chromedriver 运行到2.35.528157,现在问题已解决。希望这可以帮助!

TL; DR :运行npm install -g chromedriver

Chrome-org.openqa.selenium.WebDriverException:未知错误:无法在driver.manage()window()maximize();处获得自动化扩展

Chrome-org.openqa.selenium.WebDriverException:未知错误:无法在driver.manage()window()maximize();处获得自动化扩展

我被Chrome浏览器抛出了一种非常不寻常的错误

当我尝试使用以下代码行最大化chrome时

driver.manage().window().maximize();

我低于错误

org.openqa.selenium.WebDriverException: unknown error: cannot get automation extension
from unknown error: page could not be found: chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html
(Session info: chrome=57.0.2987.110)
(Driver info: chromedriver=2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9),platform=Windows NT 6.3.9600 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 10.05 seconds

通过本示例,我做了以下事情

1. Updated Chrome driver to latest i.e 2.28 for my Chrome version 
   57.0.2987.110 (64-bit)
2. uninstalled and re-installed Chrome
3. did a project build up in Eclipse even created a new workspace

但是没有帮助,所以我用了

    ChromeOptions options = new ChromeOptions();
    options.addArguments("start-maximized");
    driver = new ChromeDriver();

它可以正常工作,Chrome驱动程序没有显示任何错误, 但是 每当我执行一段代码(例如填写表格或单击某个按钮)后,一段时间后仍然会抛出上述错误。

Chrome-org.openqa.selenium.WebDriverException:未知错误:无法在driver.manage()。window()。maximize();处获得自动化扩展

Chrome-org.openqa.selenium.WebDriverException:未知错误:无法在driver.manage()。window()。maximize();处获得自动化扩展

我被Chrome浏览器抛出了一种非常不寻常的错误

当我尝试使用以下代码行最大化chrome时

driver.manage().window().maximize();

我低于错误

org.openqa.selenium.WebDriverException: unknown error: cannot get automation extensionfrom unknown error: page could not be found: chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html(Session info: chrome=57.0.2987.110)(Driver info: chromedriver=2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9),platform=Windows NT 6.3.9600 x86_64) (WARNING: The server did not provide any stacktrace information)Command duration or timeout: 10.05 seconds

通过本示例,我做了以下事情

1. Updated Chrome driver to latest i.e 2.28 for my Chrome version    57.0.2987.110 (64-bit)2. uninstalled and re-installed Chrome3. did a project build up in Eclipse even created a new workspace

但是没有帮助,所以我用了

    ChromeOptions options = new ChromeOptions();    options.addArguments("start-maximized");    driver = new ChromeDriver();

它可以正常工作,Chrome驱动程序没有显示任何错误, 但是 每当我执行一段代码(例如填写表格或单击某个按钮)后,一段时间后仍然会抛出上述错误。

答案1

小编典典

通常,您看到的原因 WebDriverException: unknown error: cannot get automationextension 可能很多。看到此异常的两种最常见的情况是:

  1. 二进制版本 chromedriverChrome Browser 二进制版本之间不匹配。 解决方案 :按照 ChromeDriver Release Notes
  2. 利用driver.manage().window().maximize();最大化Chrome Browser解决方案ChromeOptions.addArguments("start-maximized"); 用于最大化Chrome Browser

根据您的问题,异常似乎来自上述情况之一。

试用以下步骤:

  1. 杀死chromedriverWindows任务管理器中运行的所有实例。
  2. 使用CCleaner工具清除所有OS杂务。
  3. 在Eclipse中清理所有项目。
  4. 重启系统一次。
  5. 提供以下选项以启动您的Chrome浏览器:
    ChromeOptions options = new ChromeOptions();

    options.addArguments(“test-type”);
    options.addArguments(“start-maximized”);
    options.addArguments(“disable-infobars”);
    options.addArguments(“–disable-extensions”);
    driver = new ChromeDriver(options);

您的程序应与最新的chrome驱动程序2.28和Chrome版本57.0.2987.110(64位)一起使用。让我知道这是否对您有帮助。

Chrome浏览器中的Selenium在线程“main”org.openqa.selenium.WebDriverException中显示异常:等待驱动程序服务器启动超时

Chrome浏览器中的Selenium在线程“main”org.openqa.selenium.WebDriverException中显示异常:等待驱动程序服务器启动超时

code is correct. added code for time out exception. implicitlyWait added
public class SeleniumClass {

    public static void main(String[] args) {
        System.setProperty("webdriver.chrome.driver","C:\\\\Drivers\\\\chromedriver.exe");
        //System.setProperty("webdriver.gecko.driver","F:/Selenium/Jars and Drivers/Drivers/Firefox/geckodriver-v0.29.0-win64/geckodriver.exe");
        WebDriver driver = new ChromeDriver();
        //WebDriver driver = new FirefoxDriver();
        driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(5));
        driver.get("http://www.google.com");
    }

}
,

https://sites.google.com/a/chromium.org/chromedriver/

尝试 - 我下载了最新的稳定版本并且它有效。

org.openqa.selenium.ElementNotVisibleException:通过SeleniumWebDriver和Java单击复选框时,元素当前不可见

org.openqa.selenium.ElementNotVisibleException:通过SeleniumWebDriver和Java单击复选框时,元素当前不可见

我必须选中以下HTML代码段中包含的复选框。该复选框包含在输入标签中

<div formarrayname="entityTypes" fxlayout="" fxlayoutgap="10px">                  <divfxlayout="row" fxlayoutgap="10px">                    <app-checkbox formcontrolname="isSelected" _nghost-c26=""><div _ngcontent-c26="">  <span _ngcontent-c26=""fxlayout="row" fxlayoutalign="start center">    <!---->    <input _ngcontent-c26="" type="checkbox" name="undefined"xpath="1">      Funder      <label _ngcontent-c26=""></label>  </span>  <!---->  <!----></div></app-checkbox>                  </div>                </div>

我已经尝试过各种方法来识别并选择它,但是它从来都不可见。我已将复选框标签的文本打印到控制台,因此无法理解为什么复选框本身不可见。以下Java代码成功打印了标签,但未能单击复选框,并抛出错误元素不可见。

//print text of input boxWebElement labelFunder = driver.findElement(By.xpath("//div[@fxflex=''50'']//div[3]//div[1]//app-checkbox[1]//div[1]//span[1]//input[1]"));String textFunderLabel2 = labelFunder.getAttribute("innerText").toString();System.out.println(textFunderLabel);labelFunder.click();

我尝试了不同的等待,但均未成功。

//select the funder checkbox//driver.findElement(By.xpath("//div[@fxflex=''50'']//div[3]//div[1]//app-checkbox[1]//div[1]//span[1]//input[@type=''checkbox'']")).click();//WebDriverWait wait = new WebDriverWait(driver, 30);//WebElement checkbox = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("/html[1]/body[1]/app-root[1]/main[1]/section[1]/div[2]/app-company-detail[1]/div[2]/form[1]/md-tab-group[1]/div[1]/md-tab-body[1]/div[1]/div[1]/div[2]/div[1]/div[2]/div[3]/div[1]/app-checkbox[1]/div[1]/span[1]/input[1]")));//checkbox.click();

任何人都可以在这里向我指出正确的方向

谢谢。

答案1

小编典典

尝试使用javascript单击:

public void clickElementWithJS(By locator) {    String jsClickCode = "arguments[0].scrollIntoView(true); arguments[0].click();";    try {        WebElement elementToClick = driver.findElement(locator);        ((JavascriptExecutor) driver).executeScript(jsClickCode, elementToClick);    } catch(Exception e) {        System.out.println("Element could not be clicked.. "  + e.getMessage());    }}

关于org.openqa.selenium.WebDriverException:未知错误:调用函数结果缺少“值”调用函数出现不可知错误的介绍已经告一段落,感谢您的耐心阅读,如果想了解更多关于Chrome-org.openqa.selenium.WebDriverException:未知错误:无法在driver.manage()window()maximize();处获得自动化扩展、Chrome-org.openqa.selenium.WebDriverException:未知错误:无法在driver.manage()。window()。maximize();处获得自动化扩展、Chrome浏览器中的Selenium在线程“main”org.openqa.selenium.WebDriverException中显示异常:等待驱动程序服务器启动超时、org.openqa.selenium.ElementNotVisibleException:通过SeleniumWebDriver和Java单击复选框时,元素当前不可见的相关信息,请在本站寻找。

本文标签: