Home > other >  Python modular
Python modular

Time:03-14

The from the selenium import webdriver
From the time the import sleep
CD=webdriver. Chrome ()
CD. Implicitly_wait (20)
CD. Get (" http://127.0.0.1:8088/bugfree ")


The from the selenium. Webdriver. Support. Select the import the select
# login
CD. Find_element_by_id (' LoginForm_username). Send_keys (' admin ')
CD. Find_element_by_id (' LoginForm_password). Send_keys (' 123456 ')
CD. Find_element_by_id (' SubmitLoginBTN). Click ()
# to add into the interface
CD. Find_element_by_xpath (' CML/body/div [1]/div [2]/div [1]/a '). Click ()
# switch handle
AJ=CD. Current_window_handle
AJ1=CD. Window_handles
For n in AJ1:
If n==AJ:
Pass
The else:
CD. Switch_to. Window (n)
# to add data
CD. Find_element_by_id (' BugInfoView_title). Send_keys (' thisistest)
CD. Find_element_by_id (' BugInfoView_assign_to_name). Send_keys (' Active ')
# -- -- -- -- -- a drop-down box -
Z=CD. Find_element_by_id (' BugInfoView_severity ') # positioning to a drop-down box element
Sl #=the Select (yz) will be handed to participate to Select, yz is modified
Sl. Select_by_index (3)
# sl. Select_by_value (' 3 ')
# sl. Select_by_visible_text (' 3 ')
Lx=CD. Find_element_by_id (' Custom_BugType ')
Sl1=Select (lx)
Sl1. Select_by_index (3)
# sl1. Select_by_visible_text (' safety related)
# sl1. Select_by_value (' performance pressure)
Lx=CD. Find_element_by_id (' Custom_HowFound ')
Sl2=Select (lx)
Sl2. Select_by_index (3)
CD. Find_element_by_id (' Custom_OpenedBuild). Send_keys (' test ')
CD. Find_element_by_name (' yt0). Click ()
CD. The quit ()
The from the selenium import webdriver
From the time the import sleep
CD=webdriver. Chrome ()
CD. Implicitly_wait (20)
CD. Get (" http://127.0.0.1:8088/bugfree ")


The from the selenium. Webdriver. Support. Select the import the select
# login
CD. Find_element_by_id (' LoginForm_username). Send_keys (' admin ')
CD. Find_element_by_id (' LoginForm_password). Send_keys (' 123456 ')
CD. Find_element_by_id (' SubmitLoginBTN). Click ()
# to add into the interface
CD. Find_element_by_xpath (' CML/body/div [1]/div [2]/div [1]/a '). Click ()
# switch handle
AJ=CD. Current_window_handle
AJ1=CD. Window_handles
For n in AJ1:
If n==AJ:
Pass
The else:
CD. Switch_to. Window (n)
# to add data
CD. Find_element_by_id (' BugInfoView_title). Send_keys (' thisistest)
CD. Find_element_by_id (' BugInfoView_assign_to_name). Send_keys (' Active ')
# -- -- -- -- -- a drop-down box -
Z=CD. Find_element_by_id (' BugInfoView_severity ') # positioning to a drop-down box element
Sl #=the Select (yz) will be handed to participate to Select, yz is modified
Sl. Select_by_index (3)
# sl. Select_by_value (' 3 ')
# sl. Select_by_visible_text (' 3 ')
Lx=CD. Find_element_by_id (' Custom_BugType ')
Sl1=Select (lx)
Sl1. Select_by_index (3)
# sl1. Select_by_visible_text (' safety related)
# sl1. Select_by_value (' performance pressure)
Lx=CD. Find_element_by_id (' Custom_HowFound ')
Sl2=Select (lx)
Sl2. Select_by_index (3)
CD. Find_element_by_id (' Custom_OpenedBuild

If I log in, enter the interface, and so on operation is separated into a bag of different modules each module you want to import from the selenium import webdriver
From the time the import sleep
CD=webdriver. Chrome ()?
  • Related