Selenium RC Python code snippet

Source: Internet
Author: User

Start the browser:

Self. Selenium = Selenium ("localhost", 4444, "* Firefox", "http: // 218.108.8.83: 2048 ")

 

Open the rootPage:

Sel. Open ("/")

 

Wait for element to exitNow:

Def waitforelement (self, elementname ):

For I in range (60 ):

Try:

If self. Selenium. is_element_present (elementname): Break

Country T: Pass

Time. Sleep (1)

Else: Self. Fail ("time out ")

 

TypeData:

Sel. Type ("// input [@ ID = 'programschedulemodel _ url']", "http://justNothing.com ")

Sel. Type ("// textarea [@ ID = 'programschedulemodel _ summary ']", U"Daman UniversityBattle little monsters")

 

Select the drop down list:

Sel. Select ("// select [@ ID = 'programschedulemodel _ starthour ']", "Index = % d" % starthour)

Sel. Select ("// select [@ ID = 'programschedulemodel _ startminute ']", "Index = 0 ")

 

 

Click the hyperlink:

Sel. Click (U "link = add playing schedule ")

 

Click the button under a form

Sel. Click ("// form [@ ID = 'program-schedule-model-form'] // input [@ name = 'yt0 ']")

 

Related Article

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.