【问题标题】:unable to mouseover in headless with Xvfb using java selenium webdriver无法使用 java selenium webdriver 在 Xvfb 中无头鼠标悬停
【发布时间】:2013-09-22 02:44:04
【问题描述】:

java Webdriver mouseover 是否在无头静默模式下工作(无 GUI 显示)? 我有这段代码在 FF 无头 GUI 模式下运行时有效,但在非 GUI 模式下运行时不起作用(通过 Xvfb 帧缓冲区)。

FF 17.0.8 硒 2.33.0 Java Selenium WebDriver

我需要将鼠标悬停在菜单上,然后单击子菜单中的选项。同样,这适用于无头 GUI 模式,但不适用于无头静默(非 GUI)模式:(。如何在静默模式下调试?

mainMenu = BaseWebDriver.driver.findElement(By.linkText("Copy"));
Actions builder = new Actions(BaseWebDriver.driver);
builder.moveToElement(mainMenu).build().perform();  //perform mouse hover
//click on the option on submenu
BaseWebDriver.driver.findElement(By.xpath("//*[@id='__content']/div/div/div[2]/div[2]/ul/li[6]/ul/li[2]/a")).click();

非常感谢任何帮助! -特里

【问题讨论】:

    标签: java webdriver mouseover silent xvfb


    【解决方案1】:

    使用“sudo apt-get install xvfb”安装 xvfb
    尝试使用“xvfb-run --auto-servernum”运行您的脚本
    我将 python 与 selenium 一起使用,它对我有用,我运行了类似“xvfb-run --auto-servernum python test.py”的脚本。

    如果您正在测试的站点是公共站点,则意味着共享 url,人们会尝试相同的站点并为您提供解决方案。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-25
      • 2013-05-01
      • 1970-01-01
      • 2013-06-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多