Best Python code snippet using playwright-python
baseconfig.py
Source: baseconfig.py
...20 page.press("input[placeholder=\"请è¾å
¥ç®¡çåå¸å·\"]", "Tab")21 # Fill input[placeholder="请è¾å
¥ç®¡çåå¯ç "]22 page.fill("input[placeholder=\"请è¾å
¥ç®¡çåå¯ç \"]", "admin@1234")23 # Click input[name="log_bt"]24 # with page.expect_navigation(url="https://" + tac + ":8443/admin/main.php"):25 with page.expect_navigation():26 page.click("input[name=\"log_bt\"]")27 # Click text="身份访é®ç®¡ç"28 page.click("text=\"身份访é®ç®¡ç\"")29 30 for i in range(usernumber):31 i = i + 132 temp = str(int(time.time()*1000))33 groupname = 'ç»' + temp34 username = 'user' + temp35 # Click text="身份管ç"36 # with page.expect_navigation(url="https://" + tac + ":8443/admin/main.php?mid=13"):37 with page.expect_navigation():38 page.click("text=\"身份管ç\"")39 # Click div[id="top222"] >> text="æ·»å "40 page.click("div[id=\"top222\"] >> text=\"æ·»å \"")41 # Click //tr[normalize-space(.)='åå: *']/td[2]/span/input[1][normalize-space(@type)='text']42 page.click("//tr[normalize-space(.)='åå: *']/td[2]/span/input[1][normalize-space(@type)='text']")43 # Fill //tr[normalize-space(.)='åå: *']/td[2]/span/input[1][normalize-space(@type)='text']44 page.fill("//tr[normalize-space(.)='åå: *']/td[2]/span/input[1][normalize-space(@type)='text']", groupname)45 # Click text="ä¿å"46 page.click("text=\"ä¿å\"")47 # Click text="è¿åå表"48 page.click("text=\"è¿åå表\"")49 # Click //div[3]/a[1]/span/span[1][normalize-space(.)='æ·»å ']50 page.click("//div[3]/a[1]/span/span[1][normalize-space(.)='æ·»å ']")51 # Fill //tr[normalize-space(.)='ç»å½å: * ']/td[2]/span/input[1][normalize-space(@type)='text']52 page.fill("//tr[normalize-space(.)='ç»å½å: * ']/td[2]/span/input[1][normalize-space(@type)='text']", username)53 # Fill //span/input[1][normalize-space(@type)='password']54 page.fill("//span/input[1][normalize-space(@type)='password']", "123123")55 # Fill //tr[normalize-space(.)='确认å¯ç :  ']/td[2]/span/input[1][normalize-space(@type)='password']56 page.fill("//tr[normalize-space(.)='确认å¯ç :  ']/td[2]/span/input[1][normalize-space(@type)='password']", "123123")57 #os.system("pause")58 page.waitForSelector("text=\"请éæ©ç»\"")59 60 # Click text="请éæ©ç»"61 page.click("text=\"请éæ©ç»\"")62 63 chosenbox = "//div[@id='popup-tree-group']//span[text()='"+groupname+"']/preceding-sibling::span[1]"64 #print(chosenbox) 65 page.click(chosenbox)66 # Click text="ç¡®å®"67 page.click("text=\"ç¡®å®\"")68 69 # Click text="ä¿å"70 page.click("text=\"ä¿å\"")71 72 # Click text="è¿åå表"73 page.click("text=\"è¿åå表\"")74 appnamegroup = ['ä¸çº§åºç¨','ä¸çº§åºç¨']75 appurlgroup = ['xxx33.com','xxx250.com']76 appipgroup = ['10.92.2.33','10.92.2.250']77 appportgroup = ['80','80']78 appnumber = len(appnamegroup)79 j = 080 for j in range(appnumber):81 temp = str(int(time.time()*1000))82 appname = appnamegroup[j]83 appurl =appurlgroup[j]84 appip = appipgroup[j]85 appport = appportgroup[j]86 j = j + 187 # Click text="èµæºç®¡ç"88 # with page.expect_navigation(url="https://" + tac + ":8443/admin/main.php?mid=114"):89 with page.expect_navigation():90 page.click("text=\"èµæºç®¡ç\"")91 92 # Click a[id="toolbar-add-person"] >> text=/.*æ·»å .*/93 page.click("a[id=\"toolbar-add-person\"] >> text=/.*æ·»å .*/")94 # Click //td[normalize-space(.)='  *']/span/input[1][normalize-space(@type)='text']95 page.click("//td[normalize-space(.)='  *']/span/input[1][normalize-space(@type)='text']")96 # Fill //td[normalize-space(.)='  *']/span/input[1][normalize-space(@type)='text']97 page.fill("//td[normalize-space(.)='  *']/span/input[1][normalize-space(@type)='text']", appname + temp)98 # Click //td[normalize-space(.)='  å é¤Â ']/span/input[1][normalize-space(@type)='text']99 page.click("//td[normalize-space(.)='  å é¤Â ']/span/input[1][normalize-space(@type)='text']")100 # fill101 page.fill("//td[normalize-space(.)='  å é¤Â ']/span/input[1][normalize-space(@type)='text']", appurl)102 # Click text="åå°æå¡"103 page.click("text=\"åå°æå¡\"")104 # Click td[id="update_server_list_add"] >> text="æ°å¢ä¸ç»"105 page.click("td[id=\"update_server_list_add\"] >> text=\"æ°å¢ä¸ç»\"")106 # Click //tr[normalize-space(.)='å é¤Â ']/td[1]/span/input[1][normalize-space(@type)='text']107 page.click("//tr[normalize-space(.)='å é¤Â ']/td[1]/span/input[1][normalize-space(@type)='text']")108 # Fill //tr[normalize-space(.)='å é¤Â ']/td[1]/span/input[1][normalize-space(@type)='text']109 page.fill("//tr[normalize-space(.)='å é¤Â ']/td[1]/span/input[1][normalize-space(@type)='text']", appip)110 # Fill //tr[normalize-space(.)='å é¤Â ']/td[2]/span/input[1][normalize-space(@type)='text']111 page.fill("//tr[normalize-space(.)='å é¤Â ']/td[2]/span/input[1][normalize-space(@type)='text']", appport)112 # Click text="ä¿å"113 page.click("text=\"ä¿å\"")114 115 temp1 = str(int(time.time()*1000))116 ippoolname = 'èipæ± '117 # Click text="èµæºç®¡ç"118 # with page.expect_navigation(url="https://" + tac + ":8443/admin/main.php?mid=114"):119 with page.expect_navigation():120 page.click("text=\"èµæºç®¡ç\"")121 # Click div[id="subnav_2_15"] >> text="NC管ç"122 # with page.expect_navigation(url="https://" + tac + ":8443/admin/main.php?mid=114&p=113"):123 # with page.expect_navigation():124 # page.click("div[id=\"subnav_2_15\"] >> text=\"NC管ç\"")125 page.goto("https://" + tac + ":8443/admin/main.php?mid=114&p=113")126 # Click div[id="tabshead"] >> text="IPå°åæ± "127 page.click("div[id=\"tabshead\"] >> text=\"IPå°åæ± \"")128 # Click //div[2]/div/div/div[3]/a[1]/span/span[1][normalize-space(.)=' 添å  ']129 page.click("//div[2]/div/div/div[3]/a[1]/span/span[1][normalize-space(.)=' 添å  ']")130 # Click //tr[normalize-space(.)='åå: *']/td[2]/span/input[1][normalize-space(@type)='text']131 page.click("//tr[normalize-space(.)='åå: *']/td[2]/span/input[1][normalize-space(@type)='text']")132 # Fill //tr[normalize-space(.)='åå: *']/td[2]/span/input[1][normalize-space(@type)='text']133 page.fill("//tr[normalize-space(.)='åå: *']/td[2]/span/input[1][normalize-space(@type)='text']", ippoolname + temp1)134 # Click input[name="pool_start"]135 page.click("input[name=\"pool_start\"]")136 # Fill input[name="pool_start"]137 page.fill("input[name=\"pool_start\"]", "1.1.1.2")138 # Click input[name="pool_end"]139 page.click("input[name=\"pool_end\"]")140 # Fill input[name="pool_end"]141 page.fill("input[name=\"pool_end\"]", "1.1.1.22")142 # Click form[id="form1"] >> text="æ·»å "143 page.click("form[id=\"form1\"] >> text=\"æ·»å \"")144 # Click div[id="popup1-buttons"] >> text="ä¿å"145 page.click("div[id=\"popup1-buttons\"] >> text=\"ä¿å\"")146 temp2 = str(int(time.time()*1000))147 ncname = 'ènc设置'148 # Click //a[normalize-space(.)='èµæºç®¡ç']/img149 # with page.expect_navigation(url="https://" + tac + ":8443/admin/main.php?mid=114"):150 with page.expect_navigation():151 page.click("//a[normalize-space(.)='èµæºç®¡ç']/img")152 # Click div[id="subnav_2_15"] >> text="NC管ç"153 # with page.expect_navigation(url="https://" + tac + ":8443/admin/main.php?mid=114&p=113"):154 # with page.expect_navigation():155 # page.click("div[id=\"subnav_2_15\"] >> text=\"NC管ç\"")156 page.goto("https://" + tac + ":8443/admin/main.php?mid=114&p=113")157 # Click a[id="toolbar-add-person"] >> text=/.*æ·»å .*/158 page.click("a[id=\"toolbar-add-person\"] >> text=/.*æ·»å .*/")159 # Click //tr[normalize-space(.)='åå: *']/td[2]/span/input[1][normalize-space(@type)='text']160 page.click("//tr[normalize-space(.)='åå: *']/td[2]/span/input[1][normalize-space(@type)='text']")161 # Fill //tr[normalize-space(.)='åå: *']/td[2]/span/input[1][normalize-space(@type)='text']162 page.fill("//tr[normalize-space(.)='åå: *']/td[2]/span/input[1][normalize-space(@type)='text']", ncname + temp2)163 #to do 1.19 //finish 1.21164 # Click //td[normalize-space(.)='--- 11']/span/span/a165 page.click("//td[normalize-space(.)='--- "+ ippoolname +"']/span/span/a")166 # Click //div[2][normalize-space(.)='ipæ± çå称']167 #1.21ââæ¤å¤çå
ç´ é¡ºåºæ¯ä¾æ®IPæ± å建ç顺åºå 1ï¼è¥åå¨å¤ä¸ªè®¾ç½®ï¼éè¦ç¹æ®å¤ç168 page.click("//div[2][normalize-space(.)='"+ ippoolname +"']")169 # Click div[id="popup1-buttons"] >> text="ä¿å"170 page.click("div[id=\"popup1-buttons\"] >> text=\"ä¿å\"")171#2021.01.19æªè³ä»¥ä¸åè°è¯å®æ¯172#to do 1.21 // 11ï¼00è°è¯å®æ¯173 with page.expect_navigation():174 page.click("//a[normalize-space(.)='èµæºç®¡ç']/img")175 #page.goto("https://" + tac + ":8443/admin/main.php?mid=114&p=12018")176 # Click text="NCåºç¨"177 # with page.expect_navigation():178 # page.click("text=\"NCåºç¨\"")179 page.goto("https://" + tac + ":8443/admin/main.php?mid=114&p=12018")180 181 # Click a[id="toolbar-add-person"] >> text=/.*æ·»å .*/182 page.click("a[id=\"toolbar-add-person\"] >> text=/.*æ·»å .*/")183 # Click //td[normalize-space(.)='  *']/span/input[1][normalize-space(@type)='text']184 page.click("//td[normalize-space(.)='  *']/span/input[1][normalize-space(@type)='text']")185 # Fill //td[normalize-space(.)='  *']/span/input[1][normalize-space(@type)='text']186 page.fill("//td[normalize-space(.)='  *']/span/input[1][normalize-space(@type)='text']", "NCåºç¨")187 # Click //td[2]/div[2]/a[1]/span/span[2][normalize-space(.)=' ']188 page.click("//td[2]/div[2]/a[1]/span/span[2][normalize-space(.)=' ']")189 # Click //td[normalize-space(.)='*']/span/input[1][normalize-space(@type)='text']190 page.click("//td[normalize-space(.)='*']/span/input[1][normalize-space(@type)='text']")191 # Fill //td[normalize-space(.)='*']/span/input[1][normalize-space(@type)='text']192 page.fill("//td[normalize-space(.)='*']/span/input[1][normalize-space(@type)='text']", "10.92.2.170")193 # Click //td[normalize-space(.)='TCP UDP ICMP ANY   ']/div/span/input[1][normalize-space(@type)='text']194 page.click("//td[normalize-space(.)='TCP UDP ICMP ANY   ']/div/span/input[1][normalize-space(@type)='text']")195 # Fill //td[normalize-space(.)='TCP UDP ICMP ANY   ']/div/span/input[1][normalize-space(@type)='text']196 page.fill("//td[normalize-space(.)='TCP UDP ICMP ANY   ']/div/span/input[1][normalize-space(@type)='text']", "8443")197 # Click //td[2]/a[2]/span[normalize-space(.)='  ']198 page.click("//td[2]/a[2]/span[normalize-space(.)='  ']")199 # Click div[id="bb"] >> text="ä¿å"200 page.click("div[id=\"bb\"] >> text=\"ä¿å\"")201 # assert page.url == "https://" + tac + ":8443/admin/main.php?mid=114&p=12018#"202 # Click //td[normalize-space(.)=' ']/span/input[1][normalize-space(@type)='text']203 page.click("//td[normalize-space(.)=' ']/span/input[1][normalize-space(@type)='text']")204 # Fill //td[normalize-space(.)=' ']/span/input[1][normalize-space(@type)='text']205 page.fill("//td[normalize-space(.)=' ']/span/input[1][normalize-space(@type)='text']", "https://10.92.2.170:8443")206 # Click text="ä¿å"207 page.click("text=\"ä¿å\"")208 with page.expect_navigation():209 page.click("//a[normalize-space(.)='èµæºç®¡ç']/img")210 # Click text="代çåºç¨"211 # with page.expect_navigation(url="https://" + tac + ":8443/admin/main.php?mid=114&p=2012"):212 # with page.expect_navigation():213 # page.click("text=\"代çåºç¨\"")214 page.goto("https://" + tac + ":8443/admin/main.php?mid=114&p=2012")215 # Click a[id="toolbar-add-person"] >> text=/.*æ·»å .*/216 page.click("a[id=\"toolbar-add-person\"] >> text=/.*æ·»å .*/")217 # Click //td[normalize-space(.)='  *']/span/input[1][normalize-space(@type)='text']218 page.click("//td[normalize-space(.)='  *']/span/input[1][normalize-space(@type)='text']")219 # Fill //td[normalize-space(.)='  *']/span/input[1][normalize-space(@type)='text']220 page.fill("//td[normalize-space(.)='  *']/span/input[1][normalize-space(@type)='text']", "代çåºç¨")221 # Click //td[2]/div[2]/a[1]/span/span[2][normalize-space(.)=' ']222 page.click("//td[2]/div[2]/a[1]/span/span[2][normalize-space(.)=' ']")223 # Click //td[normalize-space(.)='*']/span/input[1][normalize-space(@type)='text']224 page.click("//td[normalize-space(.)='*']/span/input[1][normalize-space(@type)='text']")225 # Fill //td[normalize-space(.)='*']/span/input[1][normalize-space(@type)='text']226 page.fill("//td[normalize-space(.)='*']/span/input[1][normalize-space(@type)='text']", "10.92.2.250")227 # Click //tr[3]/td[2][normalize-space(.)='*']/span/input[1][normalize-space(@type)='text']228 page.click("//tr[3]/td[2][normalize-space(.)='*']/span/input[1][normalize-space(@type)='text']")229 # Fill //tr[3]/td[2][normalize-space(.)='*']/span/input[1][normalize-space(@type)='text']230 page.fill("//tr[3]/td[2][normalize-space(.)='*']/span/input[1][normalize-space(@type)='text']", "80")231 # Click div[id="bb"] >> text="ä¿å"232 page.click("div[id=\"bb\"] >> text=\"ä¿å\"")233 # assert page.url == "https://" + tac + ":8443/admin/main.php?mid=114&p=2012#"234 # Click //td[normalize-space(.)=' ']/span/input[1][normalize-space(@type)='text']235 page.click("//td[normalize-space(.)=' ']/span/input[1][normalize-space(@type)='text']")236 # Fill //td[normalize-space(.)=' ']/span/input[1][normalize-space(@type)='text']237 page.fill("//td[normalize-space(.)=' ']/span/input[1][normalize-space(@type)='text']", "http://10.92.2.250:80")238 # Click text="ä¿å"239 page.click("text=\"ä¿å\"")240#1.21 11ï¼00 以ä¸å¾
è°è¯241 # Click //a[normalize-space(.)='æé管ç']/img242 with page.expect_navigation():243 page.click("//a[normalize-space(.)='æé管ç']/img")244 # Click text="ææçç¥"245 # with page.expect_navigation(url="https://tac:8443/admin/main.php?mid=115&p=10007"):246 with page.expect_navigation():247 page.click("text=\"ææçç¥\"")248 # Click a[id="toolbar-add-person"] >> text="æ·»å "249 # with page.expect_navigation(url="https://tac:8443/admin/main.php?mid=115&p=10008"):250 with page.expect_navigation():251 page.click("a[id=\"toolbar-add-person\"] >> text=\"æ·»å \"")252 # Click //span/input[1][normalize-space(@type)='text']253 page.click("//span/input[1][normalize-space(@type)='text']")254 # Fill //span/input[1][normalize-space(@type)='text']255 page.fill("//span/input[1][normalize-space(@type)='text']", "xue")256 # Click text="ç¼è¾"257 page.click("text=\"ç¼è¾\"")258 # Check input[name="ck"]259 page.check("input[name=\"ck\"]")260 # Check tr[id="datagrid-row-r3-2-1"] input[name="ck"]261 page.check("tr[id=\"datagrid-row-r3-2-1\"] input[name=\"ck\"]")262 # Check tr[id="datagrid-row-r3-2-2"] input[name="ck"]263 page.check("tr[id=\"datagrid-row-r3-2-2\"] input[name=\"ck\"]")264 # Check tr[id="datagrid-row-r3-2-3"] input[name="ck"]265 page.check("tr[id=\"datagrid-row-r3-2-3\"] input[name=\"ck\"]")266 # Click div[id="popup-resource-buttons"] >> text="ç¡®å®"267 page.click("div[id=\"popup-resource-buttons\"] >> text=\"ç¡®å®\"")268 # Click //li[normalize-space(.)='3.ç¨æ·']269 page.click("//li[normalize-space(.)='3.ç¨æ·']")270 # Click div[id="entity-subject"] >> text="ç¼è¾"271 page.click("div[id=\"entity-subject\"] >> text=\"ç¼è¾\"")272 # Click //div[normalize-space(.)='ç»1612321180054']/span[4]273 page.click("//div[normalize-space(.)='ç»1612321180054']/span[4]")274 # Click div[id="popup-user-buttons"] >> text="ç¡®å®"275 page.click("div[id=\"popup-user-buttons\"] >> text=\"ç¡®å®\"")276 # Click text="ä¿å"277 page.click("text=\"ä¿å\"")278 # Click //div[28]/div[3]/a[1]/span/span[normalize-space(.)='ç¡®å®']279 # with page.expect_navigation(url="https://tac:8443/admin/main.php?mid=115&p=10007"):280 with page.expect_navigation():281 page.click("//div[28]/div[3]/a[1]/span/span[normalize-space(.)='ç¡®å®']")282 # Click //a[normalize-space(.)='认è¯æå¡']/img283 with page.expect_navigation():284 page.click("//a[normalize-space(.)='认è¯æå¡']/img")285 286 # Click text="认è¯æ¨¡å"287 # with page.expect_navigation(url="https://tac:8443/admin/main.php?mid=1024&p=1025"):288 with page.expect_navigation():289 page.click("text=\"认è¯æ¨¡å\"")290 # Click //span/span[normalize-space(.)='å¥å®ä¿¡ID']291 # with page.expect_navigation(url="https://tac:8443/admin/main.php?mid=1024&p=1028&"):292 with page.expect_navigation():293 page.click("//span/span[normalize-space(.)='å¥å®ä¿¡ID']")294 # Click form[id="form1"] input[type="text"]295 page.click("form[id=\"form1\"] input[type=\"text\"]")296 # Fill form[id="form1"] input[type="text"]297 page.fill("form[id=\"form1\"] input[type=\"text\"]", "å¥å®ä¿¡ID")298 # Go to https://tac:8443/admin/main.php?mid=1024&p=1025299 page.goto("https://tac:8443/admin/main.php?mid=1024&p=1025")300 # Click text="认è¯çç¥"301 # with page.expect_navigation(url="https://tac:8443/admin/main.php?mid=1024&p=1026"):302 with page.expect_navigation():303 page.click("text=\"认è¯çç¥\"")304 # Click a[id="toolbar-add-person"] >> text=/.*æ·»å .*/305 # with page.expect_navigation(url="https://tac:8443/admin/main.php?mid=1024&p=10261"):306 with page.expect_navigation():307 page.click("a[id=\"toolbar-add-person\"] >> text=/.*æ·»å .*/")308 # Click input[type="text"]309 page.click("input[type=\"text\"]")310 # Fill input[type="text"]311 page.fill("input[type=\"text\"]", "Agentçç¥")312 # Fill input[name="app[trigger_method]"]313 page.fill("input[name=\"app[trigger_method]\"]", "0")314 # Go to https://tac:8443/admin/main.php?mid=1024&p=1026315 page.goto("https://tac:8443/admin/main.php?mid=1024&p=1026")316 # Click text="认è¯é¨æ·"317 # with page.expect_navigation(url="https://tac:8443/admin/main.php?mid=1024&p=1024"):318 with page.expect_navigation():319 page.click("text=\"认è¯é¨æ·\"")320 # Click text="PC端é»è®¤é¨æ·"321 page.click("text=\"PC端é»è®¤é¨æ·\"")322 # Click //td[normalize-space(.)='é»è®¤çç¥ Agentçç¥']/span/span/a323 page.click("//td[normalize-space(.)='é»è®¤çç¥ Agentçç¥']/span/span/a")324 # Click //div[normalize-space(.)='Agentçç¥']325 page.click("//div[normalize-space(.)='Agentçç¥']")326 # Click text="ä¿å"327 page.click("text=\"ä¿å\"")328 # Click //div[13]/div[3]/a/span/span[normalize-space(.)='ç¡®å®']329 page.click("//div[13]/div[3]/a/span/span[normalize-space(.)='ç¡®å®']")330 # # Go to https://tac:8443/admin/main.php?mid=115&p=10005331 # page.goto("https://" + tac + ":8443/admin/main.php?mid=115&p=10005")332 # # Click a[id="toolbar-add-person"] >> text="æ·»å "333 # # with page.expect_navigation(url="https://" + tac + ":8443/admin/main.php?mid=115&p=10006"):334 # with page.expect_navigation():335 # page.click("a[id=\"toolbar-add-person\"] >> text=\"æ·»å \"")336 # # Click //span/input[1][normalize-space(@type)='text']337 # page.click("//span/input[1][normalize-space(@type)='text']")338 # # Fill //span/input[1][normalize-space(@type)='text']339 # page.fill("//span/input[1][normalize-space(@type)='text']", "èèµæº")340 # # Go to https://tac:8443/admin/main.php?mid=115&p=10005341 # page.goto("https://" + tac + ":8443/admin/main.php?mid=115&p=10005")342 # # Click text="ææçç¥"343 # # with page.expect_navigation(url="https://" + tac + ":8443/admin/main.php?mid=115&p=10007"):344 # with page.expect_navigation():345 # page.click("text=\"ææçç¥\"")346 # # Click a[id="toolbar-add-person"] >> text="æ·»å "347 # # with page.expect_navigation(url="https://" + tac + ":8443/admin/main.php?mid=115&p=10008"):348 # with page.expect_navigation():349 # page.click("a[id=\"toolbar-add-person\"] >> text=\"æ·»å \"")350 # # Click //span/input[1][normalize-space(@type)='text']351 # page.click("//span/input[1][normalize-space(@type)='text']")352 # # Fill //span/input[1][normalize-space(@type)='text']353 # page.fill("//span/input[1][normalize-space(@type)='text']", "èææçç¥")354 # # Go to https://tac:8443/admin/main.php?mid=115&p=10007355 # page.goto("https://" + tac + ":8443/admin/main.php?mid=115&p=10007")356 # # Click text="认è¯é¨æ·"357 # # with page.expect_navigation(url="https://" + tac + ":8443/admin/main.php?mid=1024&p=1024"):358 # with page.expect_navigation():359 # page.click("text=\"认è¯é¨æ·\"")360 # # Click a[id="toolbar-add-person"] >> text=/.*æ·»å .*/361 # page.click("a[id=\"toolbar-add-person\"] >> text=/.*æ·»å .*/")362 # # Click text=/.*è¾å
¥é¨æ·åå.*/ >> input[type="text"]363 # page.click("text=/.*è¾å
¥é¨æ·åå.*/ >> input[type=\"text\"]")364 # # Fill text=/.*è¾å
¥é¨æ·åå.*/ >> input[type="text"]365 # page.fill("text=/.*è¾å
¥é¨æ·åå.*/ >> input[type=\"text\"]", "èè·¯ç±é¨æ·")366 # # Go to https://tac:8443/admin/main.php?mid=1024&p=1032367 # page.goto("https://" + tac + ":8443/admin/main.php?mid=1024&p=1032")368 # # Click a[id="toolbar-add-person"] >> text=/.*æ·»å .*/369 # page.click("a[id=\"toolbar-add-person\"] >> text=/.*æ·»å .*/")370 # # Click form[id="form1"] input[type="text"]371 # page.click("form[id=\"form1\"] input[type=\"text\"]")372 # # Fill form[id="form1"] input[type="text"]373 # page.fill("form[id=\"form1\"] input[type=\"text\"]", "èè·¯ç±é¨æ·çè·¯ç±")374 # # Fill //tr[normalize-space(.)='åå:     åå']/td[2]/span/input[1][normalize-space(@type)='text']375 # page.fill("//tr[normalize-space(.)='åå:     åå']/td[2]/span/input[1][normalize-space(@type)='text']", "rzdoor.com")376 # # Go to https://tac:8443/admin/main.php?mid=1024&p=1024377 # page.goto("https://" + tac + ":8443/admin/main.php?mid=1024&p=1024")378 # # Click text="èè·¯ç±é¨æ·"379 # page.click("text=\"èè·¯ç±é¨æ·\"")380 # # Click //span/a381 # page.click("//span/a")382 # # Click //td[normalize-space(.)='é»è®¤çç¥']383 # page.click("//td[normalize-space(.)='é»è®¤çç¥']")384 # # Click text="ä¿å"385 # page.click("text=\"ä¿å\"")386 # # Click //div[13]/div[3]/a/span/span[normalize-space(.)='ç¡®å®']387 # page.click("//div[13]/div[3]/a/span/span[normalize-space(.)='ç¡®å®']")388 # # Click text="认è¯çç¥"389 # # with page.expect_navigation(url="https://" + tac + ":8443/admin/main.php?mid=1024&p=1026"):390 # with page.expect_navigation():391 # page.click("text=\"认è¯çç¥\"")392 # # Click a[id="toolbar-add-person"] >> text=/.*æ·»å .*/393 # # with page.expect_navigation(url="https://" + tac + ":8443/admin/main.php?mid=1024&p=10261"):394 # with page.expect_navigation():395 # page.click("a[id=\"toolbar-add-person\"] >> text=/.*æ·»å .*/")396 # # Click input[type="text"]397 # page.click("input[type=\"text\"]")398 # # Fill input[type="text"]399 # page.fill("input[type=\"text\"]", "èè·¯ç±é¨æ·ç认è¯çç¥")400 # # Fill input[name="app[trigger_method]"]401 # page.fill("input[name=\"app[trigger_method]\"]", "0")402 # # Click //span[normalize-space(.)='å¤å å']/em403 # page.frame(url="https://" + tac + ":8443/admin/aas/views/mfa_rules.php?id=0").click("//span[normalize-space(.)='å¤å å']/em")404 # # Click text=/.*åæ¶.*/405 # page.frame(url="https://" + tac + ":8443/admin/aas/views/mfa_rules.php?id=0").click("text=/.*åæ¶.*/")406 # # Go to https://tac:8443/admin/main.php?mid=1024&p=1026407 # page.goto("https://" + tac + ":8443/admin/main.php?mid=1024&p=1026")408 # # Click text="认è¯æ¨¡å"409 # # with page.expect_navigation(url="https://" + tac + ":8443/admin/main.php?mid=1024&p=1025"):410 # with page.expect_navigation():411 # page.click("text=\"认è¯æ¨¡å\"")412 # # Click //span/span[normalize-space(.)='å¥å®ä¿¡ID']413 # # with page.expect_navigation(url="https://" + tac + ":8443/admin/main.php?mid=1024&p=1028&"):414 # with page.expect_navigation():415 # page.click("//span/span[normalize-space(.)='å¥å®ä¿¡ID']")416 # # Click form[id="form1"] input[type="text"]417 # page.click("form[id=\"form1\"] input[type=\"text\"]")418 # # Fill form[id="form1"] input[type="text"]419 # page.fill("form[id=\"form1\"] input[type=\"text\"]", "å¥å®ä¿¡ID")420 # # Go to https://tac:8443/admin/main.php?mid=1024&p=1026421 # page.goto("https://" + tac + ":8443/admin/main.php?mid=1024&p=1026")422 # # Click text="èè·¯ç±é¨æ·ç认è¯çç¥"423 # # with page.expect_navigation(url="https://" + tac + ":8443/admin/main.php?mid=1024&p=10261&id=2"):424 # with page.expect_navigation():425 # page.click("text=\"èè·¯ç±é¨æ·ç认è¯çç¥\"")426 # # Click //td[normalize-space(.)='å¥å®ä¿¡ID']/span/span/a427 # page.click("//td[normalize-space(.)='å¥å®ä¿¡ID']/span/span/a")428 # # Click //div[6]/div/div[normalize-space(.)='å¥å®ä¿¡ID']429 # page.click("//div[6]/div/div[normalize-space(.)='å¥å®ä¿¡ID']")430 # # Click text="ä¿å"431 # page.click("text=\"ä¿å\"")432 # # Go to https://tac:8443/admin/main.php?mid=1024&p=1026433 # page.goto("https://" + tac + ":8443/admin/main.php?mid=1024&p=1026")434 # # Click text="认è¯é¨æ·"435 # # with page.expect_navigation(url="https://" + tac + ":8443/admin/main.php?mid=1024&p=1024"):436 # with page.expect_navigation():437 # page.click("text=\"认è¯é¨æ·\"")438 # # Click text="èè·¯ç±é¨æ·"439 # page.click("text=\"èè·¯ç±é¨æ·\"")440 # # Click //span/a441 # page.click("//span/a")442 # # Click //div[normalize-space(.)='èè·¯ç±é¨æ·ç认è¯çç¥']443 # page.click("//div[normalize-space(.)='èè·¯ç±é¨æ·ç认è¯çç¥']")444 # # Click //div[5]/div[3]/a[1]/span/span[2][normalize-space(.)=' ']445 # page.click("//div[5]/div[3]/a[1]/span/span[2][normalize-space(.)=' ']")446 # # Click //div[13]/div[3]/a/span/span[normalize-space(.)='ç¡®å®']447 # page.click("//div[13]/div[3]/a/span/span[normalize-space(.)='ç¡®å®']")448 # # Click text="å¯ä¿¡ä»£ç管ç"449 # # with page.expect_navigation(url="https://" + tac + ":8443/admin/main.php?mid=11&p=2002"):450 # with page.expect_navigation():451 # page.click("text=\"å¯ä¿¡ä»£ç管ç\"")452 # # Click text="èµæºç®¡ç"453 # # with page.expect_navigation(url="https://" + tac + ":8443/admin/main.php?mid=114"):454 # with page.expect_navigation():455 # page.click("text=\"èµæºç®¡ç\"")456 # # Click text=/.*åæ¥å°å¯ä¿¡ä»£ç.*/457 # # with page.expect_navigation(url="https://" + tac + ":8443/admin/main.php?mid=11&p=2007&op=sync&push_type=wag"):458 # with page.expect_navigation():459 # page.click("text=/.*åæ¥å°å¯ä¿¡ä»£ç.*/")460 # # Click //div[8]/div[3]/a[1]/span/span[2][normalize-space(.)=' ']461 # page.click("//div[8]/div[3]/a[1]/span/span[2][normalize-space(.)=' ']")462 # # Go to https://tac:8443/admin/main.php?mid=11&p=2007463 # page.goto("https://" + tac + ":8443/admin/main.php?mid=11&p=2007")464 # # Click text="NCåºç¨"465 # # with page.expect_navigation(url="https://" + tac + ":8443/admin/main.php?mid=114&p=12018"):466 # with page.expect_navigation():467 # page.click("text=\"NCåºç¨\"")468 # # Click text=/.*åæ¥å°å¯ä¿¡ä»£ç.*/469 # # with page.expect_navigation(url="https://" + tac + ":8443/admin/main.php?mid=11&p=2007&op=sync&push_type=l3_proxy"):470 # with page.expect_navigation():471 # page.click("text=/.*åæ¥å°å¯ä¿¡ä»£ç.*/")472 # # Click a[id="push_save_btn"] >> text="ä¿å"473 # # with page.expect_navigation(url="https://" + tac + ":8443/admin/main.php?mid=11&p=2007"):474 # with page.expect_navigation():475 # page.click("a[id=\"push_save_btn\"] >> text=\"ä¿å\"")476 # # Click text="代çåºç¨"477 # # with page.expect_navigation(url="https://" + tac + ":8443/admin/main.php?mid=114&p=2012"):478 # with page.expect_navigation():479 # page.click("text=\"代çåºç¨\"")480 # # Click text=/.*åæ¥å°å¯ä¿¡ä»£ç.*/481 # # with page.expect_navigation(url="https://" + tac + ":8443/admin/main.php?mid=11&p=2007&op=sync&push_type=l4_proxy"):482 # with page.expect_navigation():483 # page.click("text=/.*åæ¥å°å¯ä¿¡ä»£ç.*/")484 # # Click a[id="push_save_btn"] >> text="ä¿å"485 # # with page.expect_navigation(url="https://" + tac + ":8443/admin/main.php?mid=11&p=2007"):486 # with page.expect_navigation():487 # page.click("a[id=\"push_save_btn\"] >> text=\"ä¿å\"")488 # # Close page489 # page.close()490 # ---------------------491 context.close()492 browser.close()493with sync_playwright() as playwright:...
commerce.py
Source: commerce.py
...13 page.click(":nth-match([data-testid=\"categoryButton\"], 2)")14 # Click [data-testid="categoryButton"]15 page.click("[data-testid=\"categoryButton\"]")16 # Click text=Jackets17 # with page.expect_navigation(url="https://demo.vuestorefront.io/men/tops-men/jackets-men.html"):18 with page.expect_navigation():19 page.click("text=Jackets")20 # Click :nth-match(img[alt="Montana Wind Jacket"], 3)21 # with page.expect_navigation(url="https://demo.vuestorefront.io/montana-wind-jacket.html?childSku=MJ03-XS-Black"):22 with page.expect_navigation():23 page.click(":nth-match(img[alt=\"Montana Wind Jacket\"], 3)")24 # Click [aria-label="Select color Green"]25 page.click("[aria-label=\"Select color Green\"]")26 # assert page.url == "https://demo.vuestorefront.io/montana-wind-jacket.html?childSku=MJ03-XS-Green"27 # Click [aria-label="Select size M"]28 page.click("[aria-label=\"Select size M\"]")29 # assert page.url == "https://demo.vuestorefront.io/montana-wind-jacket.html?childSku=MJ03-M-Green"30 # Click [data-testid="addToCart"]31 page.click("[data-testid=\"addToCart\"]")32 # Click [data-testid="notificationAction1"]33 page.click("[data-testid=\"notificationAction1\"]")34 # insert to scroll up35 page.mouse.wheel(0, -1000)36 # Click [data-testid="openMicrocart"]37 page.click("[data-testid=\"openMicrocart\"]")38 # Click [data-testid="subscribeSubmit"]39 # with page.expect_navigation(url="https://demo.vuestorefront.io/checkout"):40 with page.expect_navigation():41 page.click("[data-testid=\"subscribeSubmit\"]")42 # Click input[name="first-name"]43 page.click("input[name=\"first-name\"]")44 # Fill input[name="first-name"]45 page.fill("input[name=\"first-name\"]", "steve")46 # Press Tab47 page.press("input[name=\"first-name\"]", "Tab")48 # Fill input[name="last-name"]49 page.fill("input[name=\"last-name\"]", "steve")50 # Press Tab51 page.press("input[name=\"last-name\"]", "Tab")52 # Fill input[name="email-address"]53 page.fill("input[name=\"email-address\"]", "steve@email.com")54 # Click [data-testid="personalDetailsSubmit"]...
mytest.py
Source: mytest.py
...12 page.click("text=\"Email, phone, or Skype\"")13 # Fill input[aria-label="Enter your email, phone, or Skype."]14 page.fill("input[aria-label=\"Enter your email, phone, or Skype.\"]", "hacker2okb@OTAPRD1485ops.onmicrosoft.com")15 # Click input[type="submit"]16 # with page.expect_navigation(url="https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize?client_id=c44b4083-3bb0-49c1-b47d-974e53cbdf3c&response_type=code%20id_token&scope=https%3A%2F%2Fmanagement.core.windows.net%2F%2Fuser_impersonation%20openid%20email%20profile&state=OpenIdConnect.AuthenticationProperties%3DMKbcSxSTICoJN1kt8D5nwvx9SQt4QkVloIDY3FogjShP6o_PQ6ehfTftIxtWpZPXMegc0nuD_uimxQ_93rRQuyPH_xyF-LYgzMBHonwKVldvLp8FCf-DIdApaWzkSRDl2V2-tzUHgSev-RcYdWHOYLak9wMqKlz1XhkgN2FN6dA-gqypCUwK56oYuxxpJhYAnqr17qKSf_SCHhJfc7_knLGbJuxMbwnPsTlc4eep8JEsQALkDnm-x3uIp0leonCFdT95bg8k0PEm0nw0YTUtfelqU90AMvtrW87J4njKceFydEE48q4ecTfSduLK-lnm2bsJ2jlNjfbe16fPD4_2n0kkoDc3nj_26Xvadyk78mtjDn0AAelkC3h_JwLdOwQk&response_mode=form_post&nonce=637426179104629098.Mzc3MjE4MjQtZGUzZC00ZjdlLWJkZjEtMDljNzhmNjljM2NlMjczNmQ3MDctZWM1My00YmYzLTg0NzktNWYzYTIyNzdmY2Qy&redirect_uri=https%3A%2F%2Fportal.azure.com%2Fsignin%2Findex%2F&site_id=501430&client-request-id=d9c101d6-d381-4640-a8af-7b643cee945d&x-client-SKU=ID_NET45&x-client-ver=5.3.0.0"):17 with page.expect_navigation():18 page.click("input[type=\"submit\"]")19 # Click text="Password"20 page.click("text=\"Password\"")21 # Fill input[aria-label="Enter the password for hacker2okb@otaprd1485ops.onmicrosoft.com"]22 page.fill("input[aria-label=\"Enter the password for hacker2okb@otaprd1485ops.onmicrosoft.com\"]", "QZiO$*CTQPQ5")23 # Click input[type="submit"]24 # with page.expect_navigation(url="https://login.microsoftonline.com/common/login"):25 with page.expect_navigation():26 page.click("input[type=\"submit\"]")27 # Click input[type="submit"]28 # with page.expect_navigation(url="https://portal.azure.com/#home"):29 with page.expect_navigation():30 page.click("input[type=\"submit\"]")31 # Click text="Virtual machines"32 page.click("text=\"Virtual machines\"")33 # assert page.url() == "https://portal.azure.com/#blade/HubsExtension/BrowseResourceBlade/resourceType/Microsoft.Compute%2FVirtualMachines"34 # Close page35 page.close()36 # ---------------------37 context.close()38 browser.close()39with sync_playwright() as playwright:...
login.py
Source: login.py
...10 page.goto("https://platform.grid.ai/#/")11 # Go to https://platform.grid.ai/#/landing12 page.goto("https://platform.grid.ai/#/landing")13 # Click img[alt="Google"]14 # with page.expect_navigation(url="https://accounts.google.com/o/oauth2/auth/identifier?after_auth_default_redirect=%2F&scope=profile%20email&redirect_uri=https%3A%2F%2Fplatform.grid.ai%2Foauth&client_id=438065754791-at0f2q42fr7dvnbggs2uj5l275enre7p.apps.googleusercontent.com&response_type=code&flowName=GeneralOAuthFlow"):15 with page.expect_navigation():16 page.click("img[alt=\"Google\"]")17 # assert page.url == "https://accounts.google.com/o/oauth2/auth?after_auth_default_redirect=%2F&scope=profile+email&redirect_uri=https%3A%2F%2Fplatform.grid.ai%2Foauth&client_id=438065754791-at0f2q42fr7dvnbggs2uj5l275enre7p.apps.googleusercontent.com&response_type=code"18 # Click [aria-label="Email or phone"]19 page.click("[aria-label=\"Email or phone\"]")20 # Fill [aria-label="Email or phone"]21 page.fill("[aria-label=\"Email or phone\"]", "sangkyulee@gmail.com")22 # Click button:has-text("Next")23 # with page.expect_navigation(url="https://accounts.google.com/signin/v2/challenge/pwd?after_auth_default_redirect=%2F&scope=profile%20email&redirect_uri=https%3A%2F%2Fplatform.grid.ai%2Foauth&client_id=438065754791-at0f2q42fr7dvnbggs2uj5l275enre7p.apps.googleusercontent.com&response_type=code&flowName=GeneralOAuthFlow&cid=1&navigationDirection=forward&TL=AM3QAYYfygCHv4k-6WHieGyWtrKg5mRX7giwapTh0EhJuENQIay3DUxcYYp8OU5k"):24 with page.expect_navigation():25 page.click("button:has-text(\"Next\")")26 # Click [aria-label="Enter your password"]27 page.click("[aria-label=\"Enter your password\"]")28 # Fill [aria-label="Enter your password"]29 page.fill("[aria-label=\"Enter your password\"]", "Spm3mw5cgSpm3mw5cr")30 # Click button:has-text("Next")31 page.click("button:has-text(\"Next\")")32 # assert page.url == "https://accounts.google.com/signin/v2/challenge/pwd?after_auth_default_redirect=%2F&scope=profile%20email&redirect_uri=https%3A%2F%2Fplatform.grid.ai%2Foauth&client_id=438065754791-at0f2q42fr7dvnbggs2uj5l275enre7p.apps.googleusercontent.com&response_type=code&flowName=GeneralOAuthFlow&cid=1&navigationDirection=forward&TL=AM3QAYYfygCHv4k-6WHieGyWtrKg5mRX7giwapTh0EhJuENQIay3DUxcYYp8OU5k"33 # Fill [aria-label="Enter your password"]34 page.fill("[aria-label=\"Enter your password\"]", "Spm3mw5cgSpm3mw5co")35 # Click button:has-text("Next")36 # with page.expect_navigation(url="https://platform.grid.ai/#/"):37 with page.expect_navigation():38 page.click("button:has-text(\"Next\")")39 # assert page.url == "https://accounts.google.com/signin/v2/challenge/pwd?after_auth_default_redirect=%2F&scope=profile%20email&redirect_uri=https%3A%2F%2Fplatform.grid.ai%2Foauth&client_id=438065754791-at0f2q42fr7dvnbggs2uj5l275enre7p.apps.googleusercontent.com&response_type=code&flowName=GeneralOAuthFlow&cid=1&navigationDirection=forward&TL=AM3QAYYfygCHv4k-6WHieGyWtrKg5mRX7giwapTh0EhJuENQIay3DUxcYYp8OU5k"40 # Go to https://platform.grid.ai/#/dashboard41 page.goto("https://platform.grid.ai/#/dashboard")42 # ---------------------43 context.storage_state(path="auth.json")44 context.close()45 browser.close()46with sync_playwright() as playwright:...
Playwright error connection refused in docker
playwright-python advanced setup
How to select an input according to a parent sibling label
Error when installing Microsoft Playwright
Trouble waiting for changes to complete that are triggered by Python Playwright `select_option`
Capturing and Storing Request Data Using Playwright for Python
Can Playwright be used to launch a browser instance
Trouble in Clicking on Log in Google Button of Pop Up Menu Playwright Python
Scrapy Playwright get date by clicking button
React locator example
I solved my problem. In fact my docker container (frontend) is called "app" which is also domain name of fronend application. My application is running locally on http. Chromium and geko drivers force httpS connection for some domain names one of which is "app". So i have to change name for my docker container wich contains frontend application.
Check out the latest blogs from LambdaTest on this topic:
The sky’s the limit (and even beyond that) when you want to run test automation. Technology has developed so much that you can reduce time and stay more productive than you used to 10 years ago. You needn’t put up with the limitations brought to you by Selenium if that’s your go-to automation testing tool. Instead, you can pick from various test automation frameworks and tools to write effective test cases and run them successfully.
When it comes to web automation testing, there are a number of frameworks like Selenium, Cypress, PlayWright, Puppeteer, etc., that make it to the ‘preferred list’ of frameworks. The choice of test automation framework depends on a range of parameters like type, complexity, scale, along with the framework expertise available within the team. However, it’s no surprise that Selenium is still the most preferred framework among developers and QAs.
Playwright is a framework that I’ve always heard great things about but never had a chance to pick up until earlier this year. And since then, it’s become one of my favorite test automation frameworks to use when building a new automation project. It’s easy to set up, feature-packed, and one of the fastest, most reliable frameworks I’ve worked with.
The speed at which tests are executed and the “dearth of smartness” in testing are the two major problems developers and testers encounter.
With the rapidly evolving technology due to its ever-increasing demand in today’s world, Digital Security has become a major concern for the Software Industry. There are various ways through which Digital Security can be achieved, Captcha being one of them.Captcha is easy for humans to solve but hard for “bots” and other malicious software to figure out. However, Captcha has always been tricky for the testers to automate, as many of them don’t know how to handle captcha in Selenium or using any other test automation framework.
LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.
Get 100 minutes of automation test minutes FREE!!