selenium automation tool

Read about selenium automation tool, The latest news, videos, and discussion topics about selenium automation tool from alibabacloud.com

Selenium + Python automation test (i)

object: · Click on Object · Send_keys analog key input on the object · Clear clears the contents of the object, if possible . Submit Submission Form Actionchains class Context_click () Right-click Double_click () Double-click Drag_and_drop () drag Webelement Other common methods: · Text gets the literal of the element · Submit Form · Get_attribute Getting property values Example: Login Baidu fromSeleniumImportWebdriverImportT

Common errors in Python automation scripts based on the Selenium module (i)

Import SysFrom time import sleepFrom selenium import WebdriverFrom selenium.webdriver.common.by Import byFrom Selenium.webdriver.support.select Import SelectDriver = Webdriver. Ie ()Driver.find_element_by_css_selector ("Div.yj-icon-box>a:nth-child (5) >i"). Click () #进入主页面Sleep (1)Driver.switch_to.frame (' IFRAME0 ')Sleep (1)Modify_frame_loc = (By.css_selector, "Div.layui-layer-content>iframe")AA = Driver.find_element (*modify_frame_loc)Driver.switch_

Selenium+python Automation 92-Multithreading launches multiple different browsers

Hantomjs") Driver=Webdriver. PHANTOMJS ()returnDriverElse: Print("Not found this browser,you can use ' Firefox ', ' Chrome ', ' ie ' or ' phantomjs '") exceptException as msg:Print("The exception occurred when starting the browser:%s"%str (msg))Multithreading launches different browsers1. Code reference:#Coding:utf-8 fromSeleniumImportWebdriverImport Time fromTomorrowImportThreadsdefStartbrowser (name):"""Open Browser functions, "Firefox", "Chrome", "ie", "PHANTOMJS"""" Try:

Python+selenium Automation Article--Analog mouse operation

).context_click(right_click).perform() print(‘成功右击‘)except Exception as e: print(‘fail‘)#输出内容:成功双击Attention: Actionchains (Driver): Call the Actionchains () class and pass the browser driver browser as a parameter Context_click (Right_click): Analog mouse Double-click, need to pass in the specified element positioning as a parameter Perform (): performs all the operations stored in Actionchains () as a series of operations prior to execution 1. Right-click Co

JAVA+SELENIUM+TESTNG Building Automation Test Architecture (1) separation of code and data

1. Introduce the JAVA+SELENIUM+POM Automatic test framework, the first to realize the separation of code and account URL and other information. The 2nd supports cross-browser implementation by reading the configuration file.1) Add information such as account URL to the properties file and read2) write the browser class by fetching the configuration file to achieve browser switching3) Test Browser classProject structure:1. Create a new folder place the

Selenium+python Automation 78-autoit parameterization and batch upload "reprint"

secondiframe = Driver.find_elements_by_tag_name (' iframe ') [1]# Switch to the IFRAMEDriver.switch_to_frame (IFRAME)# Click to open the File upload buttonDriver.find_element_by_name (' file '). Click ()Time.sleep (3)# Execute AutoIt Upload filePrint IOs.system ("C:\Users\Gloria\Desktop\cmdjpg.exe%s"% i) # your own local. exe pathTime.sleep (3)Driver.switch_to_default_content () # cut back to the main page# # Method Two: Cycle Click Upload Image# for I in range (4):# # 1 O'Clock Open editor pic

Learning Python+selenium Automation Thoughts

Finally, I stepped into the path of learning automation. Originally is to exclude the code, but did not think really seriously to learn the time, found that he is interesting, finished homework feel good to have a sense of accomplishment. Learning process, also encountered a lot of problems, try to find a solution to the problem, can not find a solution, there are colleagues to ask. This kind of learning opportunity, very rare AH.Have now learned the

Selenium+python Automation 21-txt Data parameterization

input box, the data is passed into Send_keys (Hzy). This is called by loop until all the contents of the file are read.Second, login parameterizationNow according to the above ideas, the Automation script user, the name of the password parameterized, through the Python document we found that Python read the file: The entire file read, read-line, fixed byte read.Did not find a good way to read two data at a time.Create two files, each of which holds t

Selenium+python Automation 95-pop-up box can't locate

ObjectiveSome small partners learned selenium alert, no matter what pop-up box to use alert, this is not working, see the Popup box, first to determine whether it is alert, is to use, not the words certainly can not be used. Some pop-up boxes are div layers, which are like normal positioning methods Some pop-up boxes are nested IFRAME layers, which can be switched by IFRAME Some pop-up boxes compare pits, which are embedded in a windo

Selenium+python Automation 81-html Report Optimization (pie chart + failed re-run + compatible python2&3)

WebdriverImport UnitTestClass Test1(UnitTest. TestCase):U ' ' Blog Park test ' @classmethodDef SetupClass(CLS): Cls.driver= Webdriver. Firefox () @classmethodDef Teardownclass(CLS): Cls.driver.quit ()Def Test_01(Self):U "" "Position failure Case" ""Self.driver.get ("Https://www.baidu.com")SELF.DRIVER.FIND_ELEMENT_BY_ID (' xxxxx '). Send_keys (U ' Baidu a bit ')SELF.DRIVER.FIND_ELEMENT_BY_ID (' Su '). Click ()Self.asserttrue (True)Def Test_02(Self):U ' failure case 'Self.driver.get ("http://www.

Selenium+python Automation 80-File download (Do not play inquiry box)

buttonDRIVER.FIND_ELEMENT_BY_ID ("download-btn"). Click () Four, chrome configuration#Coding:utf-8 fromSeleniumImportWebdriverprofile=Webdriver. Chromeoptions () prefs= {'profile.default_content_settings.popups': 0,#set to 0 to suppress pop-up windows 'download.default_directory':'d:\\'}#Specify the download pathProfile.add_experimental_option ('prefs', Prefs)#Executable_path This is the path to chromedriver. If the environment variable is set, this parameter can be omittedChromedriver_

Mac+python3+selenium to do PC interface Automation test

First install the environment you can refer to this article https://www.zhihu.com/question/30496889I use Chrome to browse, download Webdriver's address is http://chromedriver.storage.googleapis.com/index.html,Click to download the historical version of Chrome: https://www.chromedownloads.net/Note that the downloaded version must correspond to its own version of Chrome, or the error will be as follows: version support for Chromedriver can be viewed from http://npm.taobao.org/mirrors/chromedriver/

CSS positioning of Selenium+python automation

) to locate the child element, which is the XPath The wording is very different, in fact, very good understanding, direct translation came to the first few childrenSix, CSS: Logical Operations1.css can also implement a logical operation, matching two properties, which is not the same as XPath, no need to write the and keywordSeven, CSS: Fuzzy Matching1.css Fuzzy matching contains (' xxx '), although the Internet with a variety of data display can be used, but the small part of the test in perso

Selenium Automation-java-ie Startup

This is a method that can be called directly in mainprivate static void ie () {Webdriver Driver;IE started successfully, files is to start IE driverSystem.setproperty ("Webdriver.ie.driver", "Files/iedriverserver.exe");Code off IE some configurationDesiredcapabilities DC = Desiredcapabilities.internetexplorer ();Dc.setcapability (Internetexplorerdriver.introduce_flakiness_by_ignoring_security_domains, true);Dc.setcapability ("Ignoreprotectedmodesettings", true);Load shutdown configuration into I

Python+selenium+eclipse performing web automation (v) Special controls--progress bar

As shown, a progress bar control may appear on some Web pages, and the control's structure code is first clarified when it is processed, such as:The control here consists of three parts: a progress bar, a slider, and an input box. The input box has been introduced before, no longer tellsThe progress bar can get the current value through the Title propertySpecific operation can be achieved through the actionchains in the Move_by_offset to achieve the movement of the slider, the specific code is a

Python+selenium in the UI Automation test project, Common Tips 2: Read the configuration file (Configparser,.ini file)

9 Ten classReadconfig: One def __init__(self): A -FD =Open (Configfile_path) -data =Fd.read () the #Remove BOM - ifData[:3] = =codecs. Bom_utf8: -data = Data[3:] -File = Codecs.open (Configfile_path,"W") + file.write (data) - file.close () + fd.close () A atSELF.CF =Configparser. Configparser () - Self.cf.read (Configfile_path) -# read the information under Config - defGetconfigvalue (self, name): -Value = Self.cf.get ("Config", name) - returnvalue in# read the

Web Automation 3-selenium Basic Operations Css/xpath

1.xptah can be positioned by the attributes of the element's ID, name, classDriver.find_element_by_xpath ("//input[@id = ' kw1 ']")Driver.find_element_by_xpath ("//*[@name = ' wd ']")Driver. Find_element_by_xpath ("//*[@class = ' s_ipt ']") 2. If an element ID, name, and class attribute are not available, you can also navigate to theDriver.find_element_by_xpath ("//*[@autocomplete = ' off ']")Driver.find_element_by_xpath("//input[@type = ' text ']")3. Logical operation4.xpath IndexDriver.find_el

Web Automation 7-selenium Wait method

1. Wait methodThe sleep method of the time module is inefficientImplicitly_wait () Set Webdriver wait time, wait, wait, all elements are loaded.Webdriverwait wait for the condition to be met or timeout after exiting the display retry waitFrom Selenium.webdriver.support.ui import webdriverwaitExample 1:Browser.implicitly_wait (5)browser.find_element_by_id (' KW1 ')5 Seconds to view no KW1 elements and then an error.Example 2:From Selenium.webdriver.support.ui import webdriverwaitdef get_ele_times

Selenium + Python automation Test unittest Framework Learning (iii) WEBDRIVER element operations (ii)

The previous article is the positioning of elements, then the purpose of positioning elements is to manipulate elements, such as writing text, click Buttons, drag and so on operations(1) Simple element operationSimple element manipulationfind_element_by_id ("kw"). Clear () #文本框清空 find_element_by_id ("kw"). Send_keys ("selenium") #文本框输入find_element_by_id ("button "). Click () #点击按钮操作(2) Common oper

A simple login automation test with Python selenium+webdriver-----------bean-NET login test

= ' login ']"). Click () #使用Xpthon定位登录按钮 #d=driver.switch_to_ Alert () .text #获取点击登录后, Pop-up dialog Contents #driver.switch_to_alert (). Accept () #获取对话框焦点, accepting dialog box Contents # ifuser== ': print (' Enter an empty user name, enter a blank password, Prompt as follows: ') elifpwd== ': print (' Enter the user name%s, enter the password is empty%s, prompt as follows: '% (user,pwd)) #打印输入的用户名和密码 #else: print (' Enter the user name%s, enter the password for%s, prompt as follows: '% (user,

Total Pages: 10 1 .... 6 7 8 9 10 Go to: Go

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.