Selenium Introduction and environment constructionFirst, Brief introduction1.selenium:seleniumis one forWebTools for application testing. SeleniumThe test runs directly in the browser, just as the real user is doing. Supported browsers includeIE,Mozilla Firefox,Chromeand so on. Supports automatic recording actions and automatic generation,Net,Java,Pythontest scripts in different languages. SeleniumTestScrip
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
First, download the necessary documents1. EclipseEclipse official website2. JDKJDK website3. Selenium IDE, selenium Server, selenium Client Drivers (Java), etc.Selenium Note: A proxy server is required to download I'm using a missus cat.4. MAVEN installation, configuration,
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
variable m2_home, point to the extracted Maven directory, such as C:\Program files\java\apache-maven-3.3.3, and add%m2_home%\bin to the PATH variable.4. Copy the settings.xml files in the attachment to the following two paths:A. C:\Users\User_Name\.m2B. path\to\apache-maven-3.3.3\conf5. Open a cmd, execute mvn–v, and
Transferred from: http://www.jianshu.com/p/3c05e8c9ee81We use Java+selenium webdriver to build the environment, which is also divided into two parts:
Installing Java and IntelliJ idea
Files introduced by Maven using the specified selenium pom.xml
Mavenis a
Before I said a kind of square test to build selenium RC environment, that article is based on the Selenium RC 1.0 way, the current official website has not provided 1.0 download, I provide the download link is csdn on.
In fact, if you are familiar with MAVEN, selenium RC will become easy and easy, of course, my opera
the purpose of this tutorial, place it on the C drive of both machine A and machine B. After the doing this, you is now the done installing Selenium Grid. The following steps would launch the hub and the node.Step 3
We are now going to launch a hub. Go to machine A. Using the command prompt, navigate to the root of machine a ' s-c drive, because that is the directory WH Ere we placed the Selenium
everyone said Webdriver
Selenium's Tool kit
Selenium 2 (aka. Selenium Webdriver provides excellent test tool features such as: Associated object-oriented APIs
Selenium 1 (aka. Selenium RC or Remote control) supports more browsers and supports more programming languages (Java
The Selenium IDE is a plugin in the Firefox browser that records your actions on Firefox and replays its operations. It's easy to use, but I don't think it's very useful.
Reading Table of Contents
Selenium IDE Introduction
The role of the Selenium IDE
Selenium IDE Online Installation method one
Original URL: https://www.guru99.com/selenium-python.htmlHow to use Selenium with Python:complete TutorialSelenium supports Python and thus can be utilized with Selenium for testing.
Python is easy compared-to-other programming languages, has far less verbose.
The Python APIs empower you-to-connect with the browser through
Original URL: https://www.guru99.com/intellij-selenium-webdriver.htmlHow to use IntelliJ idea Selenium WebdriverIntellij is a IDE that helps your to write better and faster code. Intellij can used in the option to Java Bean and Eclipse.In this tutorial, you'll learn-
What is IntelliJ
Pre-requisites to IntelliJ with
Converting a common Java project into a MAVEN project is not a very big task, it only takes the following steps to make the conversion successful. Here I use a simple selenium test small demon as an example.
Move all associated libraries in a project
Convert a selenium project into a
Java selenium smart waiting for page loading to complete sample code, selenium sample code
Java selenium smart wait for page loading to complete
When Using selenium to operate an element on a page, you must wait until the page is
Is:testtofailPassed:loginFailed:testtofailjava.lang.AssertionError:expected [true] but found [false]Use of Listener for multiple classes.IF Project has multiple classes adding Listeners to each one of the them could be cumbersome and error prone.In the such cases, we can create a testng.xml and add listeners tag in XML.This listener are implemented throughout the test suite irrespective of the number of classes you have. When you run the this XML file, listeners'll work on the all classes menti
the Web driver to launch the Applic ation in the desired environment.
SetProperty is used to set the path where the driver is located. Web Driver then locates the required Driver.
Gmail website is opened in the Internet Explorer browser by using "Get" method.
Output:The test case is on Internet Explorer browser would run successfully using Selenium webdriver.ConclusionThe desired capabilities class would help to set a environment to defi
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.