ITPub博客

首页 > IT职业 > IT图书 > js操作

js操作

IT图书 作者:Jack2k 时间:2021-09-09 10:04:17 0 删除 编辑

Element is not currently visible and may not be manipulated exception

元素被遮挡,等


package test;

import org.openqa.selenium.By;

import org.openqa.selenium.JavascriptExecutor;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.WebElement;

import org.openqa.selenium.chrome.ChromeDriver;

import org.testng.annotations.Test;


public class buttongroup {


@Test

public void test() throws InterruptedException{

System.setProperty("webdriver.chrome.driver", "D:/01 Learn WebDriver/chromedriver.exe");

WebDriver dr = new ChromeDriver();

dr.manage().window().maximize();

               

        

        dr.get("file:///C:/Users/fengchuanyun/Desktop/1/%E8%87%AA%E5%8A%A8%E5%8C%96%E7%BB%83%E4%B9%A0/attribute.html");

        

WebElement el = dr.findElement(By.xpath("//*[@id='tooltip']"));

//((JavascriptExecutor)dr).executeScript("(arguments[0]).click()", el);

((JavascriptExecutor)dr).executeScript("tooltip.click()");

//dr.quit();

}

}

        

        

    


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/36/viewspace-2815826/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2007-12-08

  • 博文量
    214
  • 访问量
    17835