Best Python code snippet using robotframework-appiumlibrary_python
test_04_tool.py
Source:test_04_tool.py
...18 self.assertTrue(d)19 # å¤ææ°æ®å è½½20 self.assertTrue(self.b.find_element('xpath', '//*[@resource-id="com.vlocker.locker:id/title"]', 10))21 # ç¹å»å°å·¥å
·é¡µ22 self.b.click_button('xpath', '//*[@text="å·¥å
·"]')23 # 页é¢åç°,24 self.assertTrue(self.b.find_element('xpath', '//*[@resource-id="com.vlocker.locker:id/tool_header_progress"]', 10))25 self.b.close_app()26 def test_b_tool_lock(self):27 "éå±åè½"28 d = self.b.find_element('xpath', '//*[@text="çé¨"]', 5)29 self.assertTrue(d)30 # å¤ææ°æ®å è½½31 self.assertTrue(self.b.find_element('xpath', '//*[@resource-id="com.vlocker.locker:id/title"]', 10))32 # ç¹å»å°å·¥å
·é¡µ33 self.b.click_button('xpath', '//*[@text="å·¥å
·"]')34 # 页é¢åç°,35 self.assertTrue(self.b.find_element('xpath', '//*[@resource-id="com.vlocker.locker:id/tool_first_line"]', 10))36 self.b.click_button('xpath','//*[@text="éå±åè½"]')37 sleep(2)38 #éå±åè½é¡µé¢39 self.assertTrue(self.b.find_element('xpath','//*[@resource-id="com.vlocker.locker:id/setting_msg_layout"]',10))40 self.assertTrue(self.b.find_element('xpath', '//*[@resource-id="com.vlocker.locker:id/setting_music_layout"]',10))41 self.assertTrue(self.b.find_element('xpath', '//*[@resource-id="com.vlocker.locker:id/setting_toolbox_layout"]',10))42 self.assertTrue(self.b.find_element('xpath', '//*[@resource-id="com.vlocker.locker:id/setting_weather_item"]',10))43 self.assertTrue(44 self.b.find_element('xpath', '//*[@resource-id="com.vlocker.locker:id/setting_music_check"]', 10))45 # self.b.swipe_up(1)46 d=self.b.find_element('xpath','//*[@text="延è¿éå±"]',10)47 self.assertTrue(d)48 self.b.close_app()49 @AppiumSetup.add50 def test_c_tool_applock(self):51 "åºç¨éåè½æ ¡éª"52 d = self.b.find_element('xpath', '//*[@text="çé¨"]', 10)53 self.assertTrue(d)54 # å¤ææ°æ®å è½½55 self.assertTrue(self.b.find_element('xpath', '//*[@resource-id="com.vlocker.locker:id/title"]', 10))56 # ç¹å»å°å·¥å
·é¡µ57 self.b.click_button('xpath', '//*[@text="å·¥å
·"]')58 # 页é¢åç°,59 self.assertTrue(self.b.find_element('xpath', '//*[@resource-id="com.vlocker.locker:id/tool_first_line"]', 10))60 self.b.click_button('xpath','//*[@text="åºç¨é"]')61# æ¥çåºç¨éé»è®¤é¡µé¢62 self.assertTrue(self.b.find_element('xpath', '//*[@resource-id="com.vlocker.locker:id/l_app_select_count"]', 10))63 self.assertTrue(64 self.b.find_element('xpath', '//*[@resource-id="com.vlocker.locker:id/app_selected"]', 10))65 self.assertTrue(66 self.b.find_element('xpath', '//*[@resource-id="com.vlocker.locker:id/app_hot"]', 10))67 self.assertTrue(68 self.b.find_element('xpath', '//*[@resource-id="com.vlocker.locker:id/app_sort_desc"]', 10))69# ç¹å»ä¸ä¸æ¥70 self.b.click_button('xpath','//*[@text="ä¸ä¸æ¥"]')71 # 设置å¯ç 页æ¥ç72 self.assertTrue(73 self.b.find_element('xpath', '//*[@text="使ç¨æ°åå¯ç "]', 10))74 self.b.click_button('xpath','//*[@text="使ç¨æ°åå¯ç "]')75 self.assertTrue(76 self.b.find_element('xpath', '//*[@text="设置å¯ç ä½æ°"]', 10))77# ç¹å»ä¸ä¸æ¥78 self.b.click_button('xpath', '//*[@text="ä¸ä¸æ¥>"]')79# å¯ç 设置com.vlocker.locker:id/locknum80 d = self.driver.find_element_by_id("com.vlocker.locker:id/locknum")81 e = d.find_elements_by_id("android.widget.TextView")82 sleep(3)83 self.b.click_button('xpath', '//*[@text="1"]')84 self.b.click_button('xpath', '//*[@text="2"]')85 self.b.click_button('xpath', '//*[@text="3"]')86 self.b.click_button('xpath', '//*[@text="4"]')87# å次è¾å
¥88 self.assertTrue(89 self.b.find_element('xpath', '//*[@text="请éå¤å¯ç "]', 10))90 self.b.click_button('xpath', '//*[@text="1"]')91 self.b.click_button('xpath', '//*[@text="2"]')92 self.b.click_button('xpath', '//*[@text="3"]')93 self.b.click_button('xpath', '//*[@text="4"]')94 sleep(2)95 # self.b.click_button('xpath', '//*[@resource-id="com.vlocker.locker:id/btn_question_ok"]')96 # sleep(2)97 # self.b.click_button('xpath', '//*[@resource-id="com.vlocker.locker:id/btn_question_ok"]')98# å°å¯ç ä¿æ¤é¡µ,åªæé¦æ¬¡å®è£
appä¹åæä¼æå¯ä¿è¾å
¥99 self.assertTrue(100 self.b.find_element('xpath', '//*[@resource-id="com.vlocker.locker:id/tv_question"]', 10))101 self.b.click_button('xpath', '//*[@text="çæ¥æ¯?"]')102 sleep(3)103 # c = self.b.find_element('xpath', '//*[@resource-id="com.vlocker.locker:id/btn_question_ok"]', 10)104 # self.b.click_button('xpath', '//*[@resource-id="com.vlocker.locker:id/btn_question_ok"]')105 # self.assertTrue(c)106 # c.click()107 os.system('adb shell input tap 228 1887')108 sleep(2)109 self.assertTrue(110 self.b.find_element('xpath', '//*[@text="åºç¨é"]', 10))111 sleep(2)112 self.b.click_button('xpath', '//*[@text="åºç¨é"]')113 self.b.click_button('xpath', '//*[@text="1"]')114 self.b.click_button('xpath', '//*[@text="2"]')115 self.b.click_button('xpath', '//*[@text="3"]')116 self.b.click_button('xpath', '//*[@text="4"]')117 self.assertTrue(118 self.b.find_element('xpath', '//*[@resource-id="com.vlocker.locker:id/setting_enable_applock_img"]', 10))119 # è¿åæ¡é¢ç¹å»å¾åº120 # self.driver.keyevent(3)121 # sleep(3)122 # # å¯å¨ç¸åæ¥ç123 # cmd = "adb shell am start -W -n com.vivo.gallery/com.android.gallery3d.vivo.GalleryTabActivity "124 # self.content = os.popen(cmd)125 # sleep(2)126 # # æ ¡éªåºç¨é设置çæ127 # self.assertTrue(128 # self.b.find_element('xpath', '//*[@text="è¾å
¥å¯ç "]', 10))129 self.b.close_app()130 def test_d_restartlock(self):131 "éå¯éå±"132 d = self.b.find_element('xpath', '//*[@text="çé¨"]', 10)133 self.assertTrue(d)134 self.b.click_button('xpath', '//*[@text="æç"]')135 d = self.b.find_element('xpath', '//*[@text="设置"]', 10)136 d.click()137 # å
³ééå±å¼å
³138 d = self.b.find_element('xpath', '//*[@resource-id="com.vlocker.locker:id/close_lock_check"]', 10)139 d.click()140 # ç¹å»å¼å¯éå±141 d = self.b.find_element('xpath', '//*[@resource-id="com.vlocker.locker:id/start_lock"]', 10)142 d.click()143 self.b.close_app()144 @AppiumSetup.add145 def test_e_lockpassword(self):146 "éå±å¯ç 设置åºç¨"147 d = self.b.find_element('xpath', '//*[@text="çé¨"]', 10)148 self.assertTrue(d)149 # å¤ææ°æ®å è½½150 self.assertTrue(self.b.find_element('xpath', '//*[@resource-id="com.vlocker.locker:id/title"]', 10))151 # ç¹å»å°å·¥å
·é¡µ152 self.b.click_button('xpath', '//*[@text="å·¥å
·"]')153 # ç¹å»éå±å¯ç 154 self.b.click_button('xpath', '//*[@text="éå±å¯ç "]')155 d = self.b.find_element('xpath', '//*[@text="å¯ç 设置"]', 5)156 self.assertTrue(d)157 # ç¹å»è®¾ç½®æ°åå¯ç 158 d = self.b.find_element('xpath', '//*[@resource-id="com.vlocker.locker:id/setting_enable_num_locker_img"]', 10)159 d.click()160 sleep(2)161 # ä¸ä¸æ¥162 d = self.b.find_element('xpath', '//*[@text="ä¸ä¸æ¥>"]', 10)163 d.click()164 d = self.b.find_element('xpath', '//*[@text="4ä½å¯ç "]', 5)165 self.assertTrue(d)166 sleep(3)167 self.b.click_button('xpath', '//*[@text="1"]')168 self.b.click_button('xpath', '//*[@text="2"]')169 self.b.click_button('xpath', '//*[@text="3"]')170 self.b.click_button('xpath', '//*[@text="4"]')171 # å次è¾å
¥172 self.assertTrue(173 self.b.find_element('xpath', '//*[@text="请éå¤å¯ç "]', 10))174 self.b.click_button('xpath', '//*[@text="1"]')175 self.b.click_button('xpath', '//*[@text="2"]')176 self.b.click_button('xpath', '//*[@text="3"]')177 self.b.click_button('xpath', '//*[@text="4"]')178 # sleep(2)179 # self.b.click_button('xpath', '//*[@resource-id="com.vlocker.locker:id/tv_question"]')180 # sleep(2)181 # self.b.click_button('xpath', '//*[@resource-id="com.vlocker.locker:id/btn_question_ok"]')182 # # æ¥çå¯ç ç±»å183 # d = self.b.find_element('xpath', '//*[@resource-id="com.vlocker.locker:id/tool_bar_title"]', 10)184 # self.assertTrue(d)185 sleep(2)186 # self.b.click_button('xpath', '//*[@resource-id="com.vlocker.locker:id/btn_question_ok"]')187 # sleep(2)188 # self.b.click_button('xpath', '//*[@resource-id="com.vlocker.locker:id/btn_question_ok"]')189 # å°å¯ç ä¿æ¤é¡µ,åªæé¦æ¬¡å®è£
appä¹åæä¼æå¯ä¿è¾å
¥190 self.assertTrue(191 self.b.find_element('xpath', '//*[@resource-id="com.vlocker.locker:id/tv_question"]', 10))192 self.b.click_button('xpath', '//*[@text="çæ¥æ¯?"]')193 sleep(3)194 # c = self.b.find_element('xpath', '//*[@resource-id="com.vlocker.locker:id/btn_question_ok"]', 10)195 # self.b.click_button('xpath', '//*[@resource-id="com.vlocker.locker:id/btn_question_ok"]')196 # self.assertTrue(c)197 # c.click()198 os.system('adb shell input tap 228 1887')199 sleep(2)200 # çå±äº®å±æ¥çéå±åºç¨201 self.driver.lock(1)202 # self.driver.unlock()203 # ç¹äº®å±å¹204 cmd = 'adb shell input keyevent 26'205 os.popen(cmd)206 sleep(2)207 # å³æ»è§£é208 self.b.swipe_right(1)209 sleep(2)210 # å½åå¯ç éå±é¡µæ ¡éª211 d = self.b.find_element('xpath', '//*[@text="è¾å
¥å¯ç "]', 5)212 self.assertTrue(d)213 d = self.b.find_element('xpath', '//*[@text="ç¾åå¯ç "]', 5)214 self.assertTrue(d)215 self.b.close_app()216 @AppiumSetup.add217 def test_f_unlocknum(self):218 "解éæ°åå¯ç éå±"219 d = self.b.find_element('xpath', '//*[@text="çé¨"]', 5)220 self.assertTrue(d)221 # å¤ææ°æ®å è½½222 self.assertTrue(self.b.find_element('xpath', '//*[@resource-id="com.vlocker.locker:id/title"]', 10))223 # çå±äº®å±æ¥çéå±åºç¨224 self.driver.lock(1)225 # self.driver.unlock()226 cmd = 'adb shell input keyevent 26'227 os.popen(cmd)228 sleep(3)229 # å³æ»è§£é230 self.b.swipe_right(1)231 sleep(2)232 d = self.b.find_element('xpath', '//*[@text="ç¾åå¯ç "]', 5)233 self.assertTrue(d)234 # 解é235 self.b.click_button('xpath', '//*[@text="1"]')236 self.b.click_button('xpath', '//*[@text="2"]')237 self.b.click_button('xpath', '//*[@text="3"]')238 self.b.click_button('xpath', '//*[@text="4"]')239 d = self.b.find_element('xpath', '//*[@text="äºå¨ä¸»é¢"]', 5)240 self.assertTrue(d)241 self.b.close_app()242 @AppiumSetup.add243 def test_g_change_nopassword(self):244 " å¯ç åæ¢æ å¯ç éå± "245 d = self.b.find_element('xpath', '//*[@text="çé¨"]', 5)246 self.assertTrue(d)247 # å¤ææ°æ®å è½½248 self.assertTrue(self.b.find_element('xpath', '//*[@resource-id="com.vlocker.locker:id/title"]', 10))249 # ç¹å»å·¥å
·250 self.b.click_button('xpath', '//*[@text="å·¥å
·"]')251 # 页é¢åç°,252 self.assertTrue(self.b.find_element('xpath', '//*[@resource-id="com.vlocker.locker:id/tool_first_line"]', 10))253 # éå±å¯ç 页254 sleep(3)255 self.b.click_button('xpath', '//*[@text="éå±å¯ç "]')256 # è¾å
¥åå¯ç 257 self.assertTrue(self.b.find_element('xpath', '//*[@text="è¾å
¥åå¯ç "]', 10))258 sleep(2)259 self.b.click_button('xpath', '//*[@text="1"]')260 self.b.click_button('xpath', '//*[@text="2"]')261 self.b.click_button('xpath', '//*[@text="3"]')262 self.b.click_button('xpath', '//*[@text="4"]')263 # å°å¯ç 设置页éæ©æ å¯ç 264 self.assertTrue(self.b.find_element('xpath', '//*[@text="å¯ç 设置"]', 10))265 # ç¹å»æ å¯ç 266 self.b.click_button('xpath', '//*[@resource-id="com.vlocker.locker:id/setting_none_layout"]')267 # æ ¡éªæ¯å¦å·²ç»åæ¢å°æ å¯ç 268 a=self.b.isElement('text','个æ§è®¾ç½®')269 self.assertTrue(a)270 self.b.close_app()271 def tearDown(self):272 AppiumSetup.tearDownClass()273if __name__ == "__main__":274 unittest.main(verbosity=2)275 suite = unittest.TestSuite()276 suite.addTest(ToolTest("test_g_change_nopassword"))...
common_drivers.py
Source:common_drivers.py
...19 :return:20 """21 self.open_windows(url=url)22 if login_position: # æäºé¡µé¢è¦åæ¢å°æå®å°æ¹ï¼æè½è¿è¡ç»é23 self.click_button(locator=login_position)24 self.send_keys(locator=username['locator'], value=username['value'])25 self.send_keys(locator=password['locator'], value=password['value'])26 self.click_button(login_button)27 def chaxun_interdace(self,chacun_button,chacun_button1,chacun_button2,28 # chacun_button3,29 guke={}):30 # å
ç»å½31 # a=LoginPage()32 # self.open_windows(url= 'http://47.111.8.42:8080/mms/mms/index.html')33 # self.send_keys(locator=(a.USERNAME_INPUT),value="admir")34 # self.send_keys(locator=(a.PASSWORD_INPUT),value="1234")35 # self.click_button(a.LOGIN_BUTTON)36 # ç¹å»ä¿¡æ¯æ¥è¯¢37 self.click_button(chacun_button)38 # æ¥è¯¢é¡¾å®¢ä¿¡æ¯39 # æ¥è¯¢40 self.click_button(chacun_button1)41 # è¾å
¥é¡¾å®¢ç¼å·42 self.send_keys(locator=guke["locator"],value=guke["value"])43 # ç¹å»æ¥è¯¢44 self.click_button(chacun_button2)45 # assert "1001239" in browser.get_current_page_source()46 # self.click_button(chacun_button3)47 self.refresh()48 def chaxun_interdace_pope(self,chacun_button,chacun_button1,chacun_button2,chacun_button3,guke={}):49 # å
ç»å½50 # a=LoginPage()51 # self.open_windows(url= 'http://47.111.8.42:8080/mms/mms/index.html')52 # self.send_keys(locator=(a.USERNAME_INPUT),value="admir")53 # self.send_keys(locator=(a.PASSWORD_INPUT),value="1234")54 # self.click_button(a.LOGIN_BUTTON)55 # ç¹å»ä¿¡æ¯æ¥è¯¢56 self.click_button(chacun_button)57 # æ¥è¯¢ç»å人信æ¯58 self.click_button(chacun_button1)59 # è¾å
¥ç»å人ç¼å·60 self.send_keys(locator=guke["locator"],value=guke["value"])61 # ç¹å»æ¥è¯¢62 self.click_button(chacun_button2)63 self.click_button(chacun_button3)64 self.refresh()65 def chaxun_interdace_yaop(self,chacun_button,chacun_button1,chacun_button2,guke={}):66 # å
ç»å½67 # a=LoginPage()68 # self.open_windows(url= 'http://47.111.8.42:8080/mms/mms/index.html')69 # self.send_keys(locator=(a.USERNAME_INPUT),value="admir")70 # self.send_keys(locator=(a.PASSWORD_INPUT),value="1234")71 # self.click_button(a.LOGIN_BUTTON)72 # ç¹å»ä¿¡æ¯æ¥è¯¢73 self.click_button(chacun_button)74 # æ¥è¯¢è¯å人信æ¯75 self.click_button(chacun_button1)76 # è¾å
¥è¯åç¼å·77 self.send_keys(locator=guke["locator"],value=guke["value"])78 # ç¹å»æ¥è¯¢79 self.click_button(chacun_button2)80 self.refresh()81 def luru_guke_interdace(self,chacun_button778,chacun_button1,82 chacun_button2,ida={},name={},age={},tele={},poper={},83 time={},med={},address={},dale={},bei={}84 ):85 # å
ç»å½86 # a = LoginPage()87 # self.open_windows(url='http://47.111.8.42:8080/mms/mms/index.html')88 # self.send_keys(locator=(a.USERNAME_INPUT), value="admir")89 # self.send_keys(locator=(a.PASSWORD_INPUT), value="1234")90 # self.click_button(a.LOGIN_BUTTON)91 # ç¹å»ä¿¡æ¯å½å
¥92 self.click_button(chacun_button778)93 # ç¹å»å½å
¥é¡¾å®¢ä¿¡æ¯94 self.click_button(chacun_button1)95 # è¾å
¥ç¼å·96 self.send_keys(locator=ida["locator"], value=ida["value"])97 # è¾å
¥name98 self.send_keys(locator=name["locator"], value=name["value"])99 # è¾å
¥age100 self.send_keys(locator=age["locator"], value=age["value"])101 # è¾å
¥çµè¯102 self.send_keys(locator=tele["locator"], value=tele["value"])103 # è¾å
¥ç»å人104 self.send_keys(locator=poper["locator"], value=poper["value"])105 # æ¥æ106 self.send_keys(locator=time["locator"], value=time["value"])107 # è¯å108 self.send_keys(locator=med["locator"], value=med["value"])109 # ä½å110 self.send_keys(locator=address["locator"], value=address["value"])111 # çç¶112 self.send_keys(locator=dale["locator"], value=dale["value"])113 # å¤æ³¨114 self.send_keys(locator=bei["locator"], value=bei["value"])115 # ç¹å»å½å
¥116 self.click_button(chacun_button2)117 self.refresh()118 def luru_pope(self,can,can1,can2,can3,ida={},name={},tele={},bz={}):119 # a = LoginPage()120 # self.open_windows(url='http://47.111.8.42:8080/mms/mms/index.html')121 # self.send_keys(locator=(a.USERNAME_INPUT), value="admir")122 # self.send_keys(locator=(a.PASSWORD_INPUT), value="1234")123 # self.click_button(a.LOGIN_BUTTON)124 # ç¹å»ä¿¡æ¯å½å
¥125 self.click_button(can)126 # ç¹å»å½å
¥ç»å人127 self.click_button(can1)128 # ç¼å·129 self.send_keys(locator=ida["locator"], value=ida["value"])130 # å§å131 self.send_keys(locator=name["locator"], value=name["value"])132 # çµè¯133 self.send_keys(locator=tele["locator"], value=tele["value"])134 # å¤æ³¨135 self.send_keys(locator=bz["locator"], value=bz["value"])136 self.click_button(can2)137 self.click_button(can3)138 self.refresh()139 def luru_yaop(self,can,can1,can2,can3,ida={},name={},bz={}):140 # a = LoginPage()141 # self.open_windows(url='http://47.111.8.42:8080/mms/mms/index.html')142 # self.send_keys(locator=(a.USERNAME_INPUT), value="admir")143 # self.send_keys(locator=(a.PASSWORD_INPUT), value="1234")144 # self.click_button(a.LOGIN_BUTTON)145 # ç¹å»ä¿¡æ¯å½å
¥146 self.click_button(can)147 # ç¹å»å½å
¥è¯å148 self.click_button(can1)149 # ç¼å·150 self.send_keys(locator=ida["locator"], value=ida["value"])151 # å称152 self.send_keys(locator=name["locator"], value=name["value"])153 # åæ154 self.send_keys(locator=bz["locator"], value=bz["value"])155 # ç¹å»å½å
¥156 self.click_button(can2)157 # ç¹å»ç¡®å®158 self.click_button(can3)159 self.refresh()160 def shanchu_interdace(self,can1,can2,can3,can4,can5):161 # a = LoginPage()162 # self.open_windows(url='http://47.111.8.42:8080/mms/mms/index.html')163 # self.send_keys(locator=(a.USERNAME_INPUT), value="admir")164 # self.send_keys(locator=(a.PASSWORD_INPUT), value="1234")165 # self.click_button(a.LOGIN_BUTTON)166 # ä¿¡æ¯å é¤167 self.click_button(can1)168 # 顾客å é¤169 self.click_button(can2)170 # éæ©guke171 self.click_button(can3)172 # ç¹å»äº§å é¤173 self.click_button(can4)174 # ç¹å»ç¡®å®175 self.click_button(can5)176 self.refresh()177 def shanchu_yaop_pope(self,can,can1,can2,can3,can4):178 # a = LoginPage()179 # self.open_windows(url='http://47.111.8.42:8080/mms/mms/index.html')180 # self.send_keys(locator=(a.USERNAME_INPUT), value="admir")181 # self.send_keys(locator=(a.PASSWORD_INPUT), value="1234")182 # self.click_button(a.LOGIN_BUTTON)183 # self.click_button(can)184 # å é¤råè¯å185 self.click_button(can1)186 # éæ©å é¤äºº187 self.click_button(can2)188 # ç¹å»äº§å é¤189 self.click_button(can3)190 # ç¹å»ç¡®å®191 self.click_button(can4)192 self.refresh()193 def xiugai_interdace(self,can1,can2,can3,can4,can5,ida={},tele={}):194 # a = LoginPage()195 # self.open_windows(url='http://47.111.8.42:8080/mms/mms/index.html')196 # self.send_keys(locator=(a.USERNAME_INPUT), value="admir")197 # self.send_keys(locator=(a.PASSWORD_INPUT), value="1234")198 # self.click_button(a.LOGIN_BUTTON)199 # ä¿¡æ¯ä¿®æ¹200 self.click_button(can1)201 # 顾客修æ¹202 self.click_button(can2)203 # è¾å
¥ç¼å·204 self.send_keys(locator=ida["locator"], value=ida["value"])205 # ç¹å»æ¥è¯¢206 self.click_button(can3)207 # ä¿®æ¹å
容208 self.send_keys(locator=tele["locator"], value=tele["value"])209 # ç¹å»ä¿®æ¹210 self.click_button(can4)211 # ç¹å»ç¡®å®212 self.click_button(can5)213 self.refresh()214 def xiugai_pope_yaop(self,can1,cnn2,can3,can4,ida={},te={}):215 # 人修æ¹216 self.click_button(can1)217 # è¾å
¥ç¼å·218 self.send_keys(locator=ida["locator"], value=ida["value"])219 # ç¹å»æ¥è¯¢220 self.click_button(can2)221 # ä¿®æ¹å
容222 self.send_keys(locator=tele["locator"], value=tele["value"])223 # ç¹å»ä¿®æ¹224 self.click_button(can3)225 # ç¹å»ç¡®å®226 self.click_button(can4)227 self.refresh()228 def liulan_gk(self,can1,can2,can3,can4,can5):229 # a = LoginPage()230 # self.open_windows(url='http://47.111.8.42:8080/mms/mms/index.html')231 # self.send_keys(locator=(a.USERNAME_INPUT), value="admir")232 # self.send_keys(locator=(a.PASSWORD_INPUT), value="1234")233 # self.click_button(a.LOGIN_BUTTON)234 '''235 ç¹å»ä¿¡æ¯æµè§236 ç¹å»æµè§é¡¾å®¢237 éæ©é¡¾å®¢238 ç¹å»æ¥ç239 å
³éçªå£240 '''241 self.click_button(can1)242 self.click_button(can2)243 self.click_button(can3)244 self.click_button(can4)245 self.click_button(can5)246 self.refresh()247 def liulan_pope_yaop(self,can1):248 '''249 ç¹å»äººåè¯åæ¥ç250 '''251 self.click_button(can1)252 def daying(self,can1,can2,can3,can4):253 '''254 ç¹å»æ°æ®æ¥è¡¨255 ç¹å»é¡¾å®¢256 éæ©å
容257 ç¹å»æå°258 '''259 self.click_button(can1)260 self.click_button(can2)261 self.click_button(can3)262 self.click_button(can4)263 def dayin_pope_yaop(self,can1,can2,can3):264 '''265 ç¹å»é¡¾å®¢266 éæ©å
容267 ç¹å»æå°268 '''269 self.click_button(can1)270 self.click_button(can2)271 self.click_button(can3)272 def yonghu1_add(self,can1,can2,can3,user={},password={}):273 a = LoginPage()274 self.open_windows(url='http://47.111.8.42:8080/mms/mms/index.html')275 self.send_keys(locator=(a.USERNAME_INPUT), value="admir")276 self.send_keys(locator=(a.PASSWORD_INPUT), value="1234")277 self.click_button(a.LOGIN_BUTTON)278 '''279 ç¨æ·ç®¡ç280 ç¨æ·ç®¡ç281 æ·»å 282 è¾å
¥ç¨æ·283 è¾å
¥å¯ç 284 ç¹å»save285 '''286 self.click_button(can1)287 self.click_button(can2)288 self.click_button(can3)289 self.send_keys(locator=user["locator"], value=user["value"])290 self.send_keys(locator=password["locator"], value=password["value"])291 self.click_button(can4)292 def yonghu_xiu(self,can1,can2,can3,can4,user={}):293 '''294 ç¨æ·ç®¡ç295 éæ©å
容296 ç¹å»ç¼è¾297 ä¿®æ¹ç¨æ·298 ç¹å»save299 '''300 self.click_button(can1)301 self.click_button(can2)302 self.click_button(can3)303 self.send_keys(locator=user["locator"], value=user["value"])304 self.click_button(can4)305 def yoyhu_del(self,can1,can2,can3):306 '''307 éæ©å
容308 ç¹å»å é¤309 ç¹å»ç¡®å®310 '''311 self.click_button(can1)312 self.click_button(can2)...
Calculator Using Tkinter.py
Source:Calculator Using Tkinter.py
...12def exit():13 e1.delete(0,"end")14 value = ""1516def click_button(number):17 global value18 value = value +str(number)19 entry_val.set(value)2021def equal_button():22 global value23 equal = eval(value)24 entry_val.set(equal)25 value = ""2627# Entry282930e1 = Entry(root , width = 40 ,textvariable = entry_val )31e1.place(x = 50 , y = 30)3233# Number Button Button3435b1 = Button(root,text = "1" , padx =14 ,pady = 14 ,font=("arial 15"),command = lambda : click_button(1))36b1.place(x = 10,y = 100)3738b2 = Button(root,text = "2" , padx =14 ,pady = 14 ,font=("arial 15"),command = lambda : click_button(2))39b2.place(x = 75,y = 100)4041b3 = Button(root,text = "3" , padx =14 ,pady = 14 ,font=("arial 15"),command = lambda : click_button(3))42b3.place(x =140 ,y = 100)4344b4 = Button(root,text = "4" , padx =14 ,pady = 14 ,font=("arial 15"),command = lambda : click_button(4))45b4.place(x = 10,y = 170)4647b5 = Button(root,text = "5" , padx =14 ,pady = 14 ,font=("arial 15"),command = lambda : click_button(5))48b5.place(x = 75,y = 170)4950b6 = Button(root,text = "6" , padx =14 ,pady = 14 ,font=("arial 15"),command = lambda : click_button(6))51b6.place(x =140 ,y = 170)5253b7 = Button(root,text = "7" , padx =14 ,pady = 14 ,font=("arial 15"),command = lambda : click_button(7))54b7.place(x = 10,y = 240)5556b8 = Button(root,text = "8" , padx =14 ,pady = 14 ,font=("arial 15"),command = lambda : click_button(8))57b8.place(x = 75,y = 240)5859b9 = Button(root,text = "9" , padx =14 ,pady = 14 ,font=("arial 15"),command = lambda : click_button(9))60b9.place(x =140 ,y = 240)6162b0 = Button(root,text = "0" , padx =14 ,pady = 14 ,font=("arial 15"),command = lambda : click_button(0))63b0.place(x =10 ,y = 310)6465b_dot = Button(root,text = "." , padx =47 ,pady = 14 ,font=("arial 15"),command = lambda : click_button("."))66b_dot.place(x =75 ,y = 310)6768# calculation button697071add_b = Button(root,text = "+" , padx =14 ,pady = 14 ,font=("arial 15"),command = lambda : click_button("+"))72add_b.place(x =205 ,y = 100)7374sub_b = Button(root,text = "-" , padx =14 ,pady = 14 ,font=("arial 15"),command = lambda : click_button("-"))75sub_b.place(x =205 ,y = 170)7677mul_b = Button(root,text = "x" , padx =14 ,pady = 14 ,font=("arial 15"),command = lambda : click_button("*"))78mul_b.place(x =205 ,y = 240)7980div_b = Button(root,text = "/" , padx =14 ,pady = 14 ,font=("arial 15"),command = lambda : click_button("/"))81div_b.place(x =205 ,y = 310)8283# operational84#8586equal_b = Button(root,text = "=" , padx =14 ,pady = 48 ,font=("arial 15"),command = equal_button)87equal_b.place(x =270 ,y = 242)8889clear_b = Button(root,text = "C" , padx =14 ,pady = 48 ,font=("arial 15") , command = exit)90clear_b.place(x =270 ,y = 100)91929394root.mainloop()
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!