手记

js操作

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("https://passport.cnblogs.com/user/signin");

        

        Thread.sleep(2000);

        

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

((JavascriptExecutor)dr).executeScript("$(arguments[0]).fadeOut()", el);

//((JavascriptExecutor)dr).executeScript("$(input1).fadeOut()");

*/        

        

        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();

}

}

        

        

    


0人推荐
随时随地看视频
慕课网APP