如何使用java通过selenium-webdriver和Java鼠标悬停

时间:2017-11-13 09:35:20

标签: java selenium selenium-webdriver webdriver selenium-chromedriver

尝试自动化门户http://demo.nopcommerce.com/时,无法选择鼠标悬停在“Electornics”菜单上并选择“Camera& Photo”子菜单。 使用下面的脚本。

WebElement electronic_Pdts = driver.findElement(By.xpath("//*[@class='title']//*[@title='Show products in category Electronics']"));
action.moveToElement(electronic_Pdts).build().perform();
driver.findElement(By.xpath("//*[@src='http://demo.nopcommerce.com/images/thumbs/0000006_camera-photo_450.jpeg']")).click();

1 个答案:

答案 0 :(得分:1)

"Electornics" 超过 "Camera & Photo" 菜单并选择 driver.get("http://demo.nopcommerce.com/"); Actions act = new Actions(driver); WebDriverWait wait = new WebDriverWait(driver, 10); WebElement electronics = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//li/a[@href='/electronics']"))); act.moveToElement(electronics).perform(); WebElement camera_n_photo = driver.findElement(By.xpath("//li/a[@href='/electronics']//following::ul/li/a")); camera_n_photo.click(); System.out.println("Camera & photo Clicked."); ,您可以使用以下代码阻止:

declare 
  -- Local variables here
  tstjson_list pljson_list;
  l_Result_json_clob clob;
begin
  -- Test statements here
  tstjson_list := pljson_list();
  dbms_lob.createtemporary(l_Result_json_clob, true);

  tstjson_list := pljson_util_pkg.sql_to_json('SELECT 0.1 as tmp from dual');
  tstjson_list.to_clob(l_Result_json_clob);
end;