Reference Package import org.openqa.selenium.by;import org.openqa.selenium.webdriver;import org.openqa.selenium.webelement;import org.openqa.selenium.firefox.firefoxdriver;public class Test001 {public static void main (String[] args) {//Browser Path system.setproperty ("Webdriver.firefox.bin", "D:/firefox/firefox.exe"); /* new Browser Driver // here is Firefox driver, other browser driver reference // http://diaosi58.blog.51cto.com/2722311/1671998 Documentation */ WebDriver driver = new Firefoxdriver (); //Enter a connection to the browser input field driver.get ("http://huodong.12kaixue.net/s/0-v134.html"); //get page Buttons Webelement rush_btn = driver.findelement (By.id ("rush_btn")); //Click button rush_ Btn.click (); //browser maximized maxbrowser (driver) ; setscroll (driver,500); //Find page Floating div driver.findelement (By.classname ("FL")). Click (); //find the page floating div, the account input box driver.findelement (By.xpath ("//input[@id = ' username ']"). SendKeys ("x986"); //find page floating div, password input box Driver.findelement (By.xpath ("//input[@id = ' password ']). SendKeys ("a123456"); //find page floating div, login button , click Sign In driver.findelement (By.classname ("Submit-input")). Click (); //Shutdown Events driver.close ();} Private static void setscroll (webdriver driver, int i) {// TODO Auto-generated method stub}private static void maxbrowser (WebDriver driver) {// todo auto-generated method stub}}
If you want to make the project circle a friend, add a looping statement. If you do not understand please add me qq:807002272 or email [email protected]
This article is from "want to fly fish". "Blog, be sure to keep this provenance http://diaosi58.blog.51cto.com/2722311/1679163
[selenium2]-How to get the website floating div