2017-06-04 67 views
0

的Firefox版本:52.0.2(32位)
平台:Windows 7的 - 64位
硒webdriver的版本:3.4.0(Java绑定)
GeckoDriver:0.16.0
问题描述:
Selenium 3.x无法执行双击操作。 测试代码:硒3.X双击不工作

public class GeckoTest { 
    public static void main(String[] args) throws IOException { 
     System.setProperty("webdriver.gecko.driver","I:\\jetbrainsworkspace\\src\\test\\resources\\geckodriver.exe"); 
     FirefoxBinary binary = new FirefoxBinary(new File("D:\\installations\\browsers\\ff\\52.0.2_32\\firefox.exe")); 
     FirefoxOptions options = new FirefoxOptions(); 
     options.setBinary(binary); 
     options.setLogLevel(Level.ALL); 
     WebDriver browser = new FirefoxDriver(options); 
     browser.manage().timeouts().pageLoadTimeout(10, TimeUnit.SECONDS); 
     browser.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS); 
     browser.get("https://examples.sencha.com/extjs/6.0.1/examples/classic/ticket-app/index.html"); 
     WebDriverWait wait = new WebDriverWait(browser,20,3000); 
     wait.until(ExpectedConditions.visibilityOfElementLocated(By.name("password"))).sendKeys("sometext"); 
     wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(".//span[text()='Login']"))).click(); 
     WebElement ele = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(".//div[text()='Fiant adipiscing clari nunc molestie per placerat vero insitam; ullamcorper saepius etiam claritatem quod.']"))); 
     Actions builder = new Actions(browser); 
     builder.doubleClick(ele).build().perform(); 
     browser.close(); 
    } 
} 

编辑:手动步骤

  1. 导航到EXTJs link
  2. 登录任何密码。
  3. 在右侧你会发现一张门票表。
  4. 如果您双击任何一张门票,然后它将打开该门票。
+0

你能考虑更新我们提供您的手动测试步骤吗? – DebanjanB

+0

你的元素是否支持双击?还是你想点击选择/突出显示文本? – Murthi

+0

看来这是一个已知问题,需要硒贡献者小组进一步调查:https://github.com/mozilla/geckodriver/issues/661 –

回答

2

为了克服硒try Alternative workaround Source

与双击问题简化为如下:

((JavascriptExecutor) driver).executeScript("document.getElementById('map_container').dispatchEvent(new Event('dblclick'));");