Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

[Selenium2]-how to get a floating DIV for a website

Shulou Source: shulou.com Published: 2022-06-03 05:45:40 11月24日 Update

/ / 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") / * create a new browser driver / / here is the Firefox browser driver, other browser drivers refer to / / http://diaosi58.blog.51cto.com/2722311/1671998 documentation * / WebDriver driver = new FirefoxDriver () / / enter a connection driver.get to the browser input field ("http://huodong.12kaixue.net/s/0-v134.html"); / / get page button WebElement rush_btn = driver.findElement (By.id (" rush_btn ")); / / Click the button rush_btn.click () / / maximize the browser maxBrowser (driver); setScroll (driver,500); / / find the page floating DIV driver.findElement (By.className ("fl"). Click () / / find page floating DIV, 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 the page floating DIV, log in button, and click login driver.findElement (By.className ("submit-input")) .click (); / / close event 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 loop, please add the loop statement. If you don't understand, please add me QQ:807002272 or email kasthjob@126.com.

Tags: Browser browse page float input button drive loop login maximum event password document friend Firefox statement path mail project account Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Redmi Xiaomi Docker NVidia