右键单击后无法在新选项卡中选择“打开链接”

时间:2018-09-19 07:21:57

标签: c# selenium

在网页上,我可以右键单击链接,但是不能选择第一个选项“在新标签页中打开链接”。

以下是详细信息:

Selenium WebDriver - v3.14.0
Selenium WebDriver Support - v3.14.0
Chrome Driver - v2.41.0
Visual Studio 2017 in Windows 10 (Selenium C#)
Chrome Browser - 69.0.3497.100 (64 Bit)

请让我知道如何处理。我已经搜索了该论坛,但得到的结果仅与Firefox相关。

以下是我正在使用的代码:

public void RightClickByXPathAndSelectOption(string webElementXPath)
{    
    Actions action = new Actions(driver);
    action.ContextClick(driver.FindElement(By.XPath(webElementXPath))).SendKeys(Keys.ArrowDown).SendKeys(Keys.Enter).Build().Perform();
}

0 个答案:

没有答案
相关问题