....OnMouseMoveHandler(..)
MousePosition = Me.PointToClient(Cursor.Position)
Debug.Print("Mouse position : X = " & MousePosition.X & ", " & MousePosition.Y)
Me.EyePupilShape.Location = New Drawing.Point(Clamp(MousePosition.X, 32, 50), Clamp(MousePosition.Y, 31, 50))
答案 0 :(得分:1)
在将路径分配给ChromeDriver
之前,请不要实例化chromedriver.exe
类。将实例化代码移至beforeMethod
。
尝试以下代码:
package day2practice;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class day2 {
ChromeDriver driver;
@BeforeMethod
public void beforeMethod() {
System.setProperty("webdriver.chrome.driver","C:\\Users\\Ashok\\Desktop\\chromedriver.exe");
driver = new ChromeDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver.navigate().to("http://live.guru99.com");
}
@Test
public void f() {
String actual = driver.getTitle();
String expected = "THIS IS DEMO SITE";
Assert.assertEquals(actual, expected, "page title is same");
}
@AfterMethod
public void close() {
driver.quit();
}
}