我有一个 Selenium 脚本来执行以下步骤:
- 启动网站 - https://vusevapor.com/
- 点击“我 21 岁以上”按钮
- 移动到元素设备。
- 右键单击 ciro 完整套件。
问题是右键单击菜单保持原样,并且元素在同一页面上被单击。
这是我的代码:
//website
driver.get("https://vusevapor.com/");
//clicking on i am 21+ button
driver.findElement(By.xpath("/html/body/aside/div[2]/div/div/div[2]/div/a[1]/span")).click();
Thread.sleep(5000);
//xpath of devices menu
WebElement devices = driver.findElement(By.xpath("//*[@id=\"store.menu\"]/nav/ul/li[2]/a/span"));
//move to element devices
Actions act = new Actions(driver);
act.moveToElement(devices).build().perform();
Thread.sleep(3000);
//xpath of ciro complete kit
WebElement ciroKit = driver.findElement(By.xpath("//*[@id=\"store.menu\"]/nav/ul/li[2]/ul/li[2]/ul/li[1]/a/span"));
//right click on ciro complete kit
//*****Issue********right click is happening but the element is getting clicked on the same tab and right click menu remains as is
act.contextClick(ciroKit).sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.ENTER).build().perform();