[selenium2]-How to get the website floating div

Source: Internet
Author: User
Tags xpath

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.