1, basic small program examples:
A basic point landing operation via Google Chrome
String key= "Webdriver.chrome.driver"; String value= "C:/users/gmsd11/desktop/selenium/chromedriver.exe";System.setproperty (key, value);//system automatically configures the corresponding parameters webdriver driver=new chromedriver ();When instantiating an object, the corresponding browser has opened (initialized browser) driver.manage (). window (). Maximize (); Driver.manage (). Timeouts (). Implicitlywait (10,Timeunit.seconds);//parameter 10 can be understood as the time of the wait, and the following timeunit.seconds refers to the units of the time setdriver.get ("Http://gmsdtech:[email protected]/");//Note: Gmsdtech:[email protected] Plus this is the pop-up box webelement Username=driver that is designed to handle Windows authentication.findelement (by.id ("username"));username.clear ();Username.sendkeys ("admin"); Webelement password=driver.findelement (by.id ("password")); Password.clear (); Password.sendkeys ("admin"); Webelement button=driver.findelement (By.xpath ("/html/body/div/section/div/div/div/form/p[4]/input")); Button.Click ();
Selenium+webdriver+java Basic Knowledge points