Test courses at school, access to automated management tools, and work with teaching assistants to change jobs, so think about learning selenium, a powerful web automation tool.1.lenium official website: http://www.seleniumhq.org/Download the Selenium installation package here, I downloaded the selenium-java-3.8.0. The
Last year contacted Selenium, and find the data to install the success, this post has been written unpublished, now issued to record it.First, install Selenium Server1. Access to the official website: http://www.seleniumhq.org/download/2. Download Selenium Standalone Server(Selenium-server-standalone-3. Download
BufferedReader class to read the fileString s = null; while ((s = br.readline ()) =null) {//Use the ReadLine method to read one line at a timeresult = result + "\ n" +s;}Br.close ();}catch(Exception e) {E.printstacktrace ();}return result;}Main method invocationFile File = new file ("C:/a.txt");//Read filesSystem. out. println (txt2string(file) + "a");The problem: The orc recognition rate is still very low, the chance of login success has not exceeded 90%, need to improveSolution: Train the Orc
Selenium1,selenium IDE mac installation Open the Firefox browser, go to the following URL https://addons.mozilla.org/en-US/firefox/addon/selenium-ide/, Click Add to Firefox. Can be added to the toolbar. NBSP;2,SELENIUM1) version of the jar package download: http://selenium-release.storage.googleapis.com/ Index.html the system uses the 2.50.1 to create a new
Webdriver is selenium 2. Webdriver is an excellent, open source, automated testing framework. Supports many languages. This article describes how to build an environment with Java Eclipse
Reading Table of Contents
First download good eclipse and configure Java environment variables
Method add a Jar package
Method two direct Reference
correctly, enter win+r, open cmd, enter java-version, Get the installation success:(2) Eclipse or MyEclipse tools;Download three files: Selenium-java-2.48.2.jarSelenium-java-2.48.2-srcs.jarSelenium-server-standalone-2.46.0.jarThese three files are to be placed in the Lib of the project.2. Browser:Support ie,firefox,Go
")). SendKeys ("iframe input");
Driver.switchto (). FRAME ("Framea");
Driver.findelement (By.id ("Iframeinput")). SendKeys ("iframe input");
There is no main window, the following statement will error
//driver.findelement (by.id ("Maininput")). SendKeys ("main input");
Return to the main window
Driver.switchto (). Defaultcontent ();
Driver.findelement (By.id ("Maininput")). SendKeys ("main input");
}
The above is the
Java Selenium Smart Wait page load complete
We often encounter the use of selenium to manipulate an element on the page, you need to wait for the page to be completed after loading to operate. Otherwise, the element on the page does not exist, and an exception is thrown.
or encounter Ajax asynchronous loading, we need to wait for the element load to complete be
the source code you just downloaded.Detailed Engineering Structure:One of the simplest standard MAVEN projects, where the source code is placed under the Src/main/java directory, the test code is placed in the Src/test/java directory;MAVEN also created a pom.xml that manages the jar packages that the project relies on for you.The upper Isn't it convenient?4. Check if the environment is ready to completeIn
First, the Operation Pop-up windowPrincipleIn the code, through setTo get a handle to all pop-up browsers, and then traverse through, using the Swithcto.window (Newwindow_handle) method. You can navigate to the new window.HTML of the test page
Java Code
public static void Testmultiplewindowstitle (Webdriver driver) throws Exception
{
String url= "E:\\stashfolder\\[email
Selenium+java: Gets the value in the list(2011-08-23 17:14:48)
Tags: gossip
Category: Selenium
A preliminary study using the JAVA+TESTNG framework to write selenium test cases today learned several APIs:(1) Get the values from the list on the
The Python environment builds Eclipse 4.5, Java 8, PyDev 5.2.0, Python3.7, selenium-3.14.01 installation Python: http://www.python.org/Python has 32 versions of Python 2 and Python. There are some differences in grammar.I install Python 3.7.0To configure environment variables after installation2 installation JAVA JDK: http://www.oracle.com/technetwork/
title and link (only 15 pages), and the results take the first page as an example:****************"Tools to share" jmeter large file analysis tool, 30 times times faster than the official analysis toolshttp://ask.testfan.cn/article/1275Selenium Operation 360 Browserhttp://ask.testfan.cn/article/1223TESTFAN3 Monthly Interface Free benefit course--seconds kill instructionshttp://ask.testfan.cn/article/1201Python coveragehttp://ask.testfan.cn/article/11
How to handle pop-up windows in selenium
Reading Table of Contents
Principle
To test the HTML of a page
Java Code
Principle
In the code, through set
To get a handle to all pop-up browsers, and then iterate through it using the Swithcto.window (Newwindow_handle) method. You can navigate to a new window
To test the HTML of a page
Java
()) { - webelement wb = (webelement) iterator.next (); - Wb.click (); - } in //Get rid of the first - WaitTime (+); to driver.findelements (By.cssselector ("[Type=checkbox]")). Get (0). Click (); + - //Remove the last one the WaitTime (+); * driver.findelements (By.cssselector ("[Type=checkbox]")). Get (Webelements.size ()-1). Click (); $ Panax Notoginseng - WaitTime (the); the driver.quit (); + } A the static public void waitTime (int time) { + - try
the action to get the page element, click the button, and enter the form.the Selenium offers 8 positioning methods:
Id
Name
Class name
Tag name
Link text
Partial link text
Xpath
CSS Selector
here are the 8 ways to locate in the code:
Findelement (By.id ())
Findelement (By.name ())
Findelement (By.classname ())
Findelement (By.tagname ())
Findelement (By.linktext ())
Findelement (B
Seleniu automated test scripts written in the Java language are typically run in the Eclipse integrated development environment, so the Java environment needs to be built before the selenium environment can be built.One: Get the JDK installation package:Method One: Official: http://www.oracle.com/technetwork/java/javas
These days learning selenium, big head shrimp me. Installation environment or encountered a lot of problems, hurry to record. or next time ... ("Selenium2 Java Automation Test Practice"), just write and deepen your impressions. 1. Install JavaVisit the Java website to download the JDK http://www.oracle.com/technetwork/java
No reprint without the permission of the author!!!Java Selenium webdriver Processing JS operation window scroll barJava Selenium webdriver Processing JS operation window scroll barImportOrg.openqa.selenium.JavascriptExecutor;ImportOrg.openqa.selenium.WebDriver;ImportOrg.openqa.selenium.chrome.ChromeDriver; Public classJS20161212 { Public Static voidMain (string[]
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.