://download.eclipse.org/technology/m2e/releasesthen click Next until the installation is complete. Set MAVEN program associated with the Maven plugin :Select window-->preferences-->maven--installations menu item in the Eclipse menu bar , pointClick Add to select The specific installation directory for Mavento set up a custom local warehouse :Select window-->preferences-->maven--usersettings menu item in the Eclipse menu bar , repairchange to our custom warehouse location under the settings.xml
requires two racks: Selenium-java-2.44.0.jar and Selenium-server-standalone-2.48.2.jar. different browser version corresponding to different selenium rack package version, I am currently trying to version of Firefox and selenium corresponding version: Firefox 33.0->selenium
clicked
Elementtobeclickable (by Locator)
The page element is in the selected state
Elementtobeselected (webelement Element)
Page elements exist in the page
Presenceofelementlocated (by Locator)
Whether to include specific text in the page element
Texttobepresentinelement (by Locator)
Page element values
Texttobepresentinelementvalue (by locator, java.lang.String text)
Caption (title)
Titlecontai
In automated testing we can not avoid to imitate some keyboard buttons on the operation, ordinary letters, numbers, special symbols, these are very simple, and sometimes we will imitate "SHIFT", "ALT", "CONTROL", these selenium has provided the action, Specific as follows: New Actions (driver); Actions.keydown (Keys.control); // Press to release control Actions.keydown (keys.control); Actions.keydown (keys.shift); // Press
Webdriver is selenium 2. Webdriver is an excellent, open-source, automated testing framework. Support many languages. This article describes how to build an environment with Java EclipseRead Catalog first download the Eclipse and configure the Java environment variable step omitted, please Baidu method add jar PackageOfficial: http://www.seleniumhq.org/download/O
Recently to summarize the automated test selenium some of the commonly used framework test collocation, by simple into the complex, the simplest is selenium+java+testng, because I use Java, just summarize the next java.TestNG Online Installation:Open Eclipse help->install New software, then add "Http://beust.com/eclips
Recently in the study of Java+selenium automated testing, online more information, their own test practice, sorting out a relatively perfect set of environmental information, because many online download practice process, found a lot of mismatch problems, what JDK and Eclipse does not match, Selenium and Fire Fox don't match.First, the development environment:1,
;"); - - //can be partially matched using the Java String API method -Assert.asserttrue (Messagetext.contains ("Job search"))); -Assert.asserttrue (Messagetext.startswith ("View short rent")); -Assert.asserttrue (Messagetext.endswith (">>")); in - //Close Driver to driver.quit (); + } -}code Example2. Get element attribute valuesThe GetAttribute () of the Webelement class returns the attribute value of the element
";Adfileupload.sendkeys (FilePath);1.6 Switching between Windows and frames
Driver.switchto (). Defaultcontent (); Return to the top-most frame/iframe
Driver.switchto (). FRAME ("Leftframe"); Switch to a frame:
Driver.switchto (). Window ("Windowname"); Switch to a window
1.7 Calling Java ScriptWeb driver calls to Java script are implemented through Javascriptexecutor, for example:Java
How to handle popup windows in SeleniumRead CataloguePrincipleIn 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 pageHTML>Head> title>Common Web UI element operations, and API usagetitle> Scripttype= "Text/javascript"> functionOpen_win () {window.open ("http://www.cnblogs.com") } Script>Head>Body> form> inputtype=buttonv
://ask.testfan.cn/article/1169"Android" To view the app under test package and launchable-activityhttp://ask.testfan.cn/article/1168Quick position Appium Sliding coordinateshttp://ask.testfan.cn/article/1158Design method of test casehttp://ask.testfan.cn/article/1157Common commands for test workhttp://ask.testfan.cn/article/1153Jekins Installation Documentationhttp://ask.testfan.cn/article/1152QTP Frequently Asked questions (Baidu collation)http://ask.testfan.cn/article/1151Testfan10 Month Outdo
1. JDK2.eclipse+testng>TESTNG installation.Name:testng Location:http://beust.com/eclipse.3.selenium WebdriverDownload Selenium Webdriver jar Package http://docs.seleniumhq.org/download/Selenium official website> Unzip when the download is complete.> Create a Java Project in eclipse.> Copy the files you just extracted.>
()) { - 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
1, basic small program examples:A basic point landing operation via Google ChromeString key= "Webdriver.chrome.driver"; String value= "C:/users/gmsd11/desktop/selenium/chromedriver.exe";System.setproperty (key, value);//system automatically configures the corresponding parameters webdriver driver=new chromedriver ();When instantiating an object, the corresponding browser has opened (initialized browser) driver.manage (). window (). Maximize ();
What is an IFRAMEAn IFRAME is an HTML that is used for Web page nesting. A Web page can be nested in another Web page and can nest many layers.A method for entering an IFRAME is provided in the seleniumEnter the ID called Framea of Iframedr.switchto (). FRAME ("Framea");Back to main window Dr.switchto (). Defaultcontent ();Main.htmlFrame.htmlSelenium code public static void Testiframe (Webdriver driver) { driver.get ("E:\\stashfolder\\[email protected]\\stash\\ tank-moneyproject\\ P
represents the default pathProfile.setpreference ("Browser.download.manager.showWhenStarting",false);//whether to show start//Suppress pop-up save box, value is file format, such as ZIP fileProfile.setpreference ("Browser.helperApps.neverAsk.saveToDisk", "Application/zip,text/plain,application/vnd.ms-excel,text/csv,text/comma-separated-values,application/ octet-stream,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/ Vnd.openxmlformats-officedocument.
Selenium webdriver tests pop-up windows, including identifying pop-ups, transferring driver to a new window, executing the steps in a new string hook, and then converting to the original window.Identified and processed by name:Selenium Webdriver allows us to identify the window through the Name property or a handle to the window, and then switch between the different Windows through the Webdriver.switchto (). Window () method.Definition of Window Name
Selenium Webdriver provides an implicit wait to synchronize the test. When an implicit wait is used to execute the test, if the Webdriver does not find the element in the DOM, it will continue to wait, after the set time is exceeded, the element exception is not foundThat is, when the element does not appear immediately, the implicit wait waits for a period of time before looking for the DOM. The default time is 0.Once an implicit wait is set, it will
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:
[email protected]
and provide relevant evidence. A staff member will contact you within 5 working days.