51Testing软件测试论坛
标题:
关于playwright #python#的问题:超时后报错
[打印本页]
作者:
测试积点老人
时间:
2021-8-13 11:21
标题:
关于playwright #python#的问题:超时后报错
代码如下
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch(headless=False)
context = browser.new_context()
page = context.new_page()
list1 = ['Russian Federation','United States','Canada','Spain','France','United Kingdom','Netherlands','Israel','Brazil','Chile','Australia','Ukraine','Belarus','Japan','Thailand','Singapore','South Korea','Indonesia','Malaysia','Philippines','Vietnam','Italy','Germany','Saudi Arabia','United Arab Emirates','Poland','Turkey','Portugal']
print(list1[0])
page.goto("https://www.aliexpress.com/item/1005001955136541.html")
print(page.inner_text("#root > div > div.product-main > div > div.product-info > div.product-price > div.product-price-current > span"))
for i in list1:
print(i)
page.click("#root > div > div.product-main > div > div.product-info > div.product-shipping > span.product-shipping-info.black-link")
page.click("body > div.next-overlay-wrapper.opened > div.next-overlay-inner.next-dialog-container > div > div.next-dialog-body > div > div.address > span > span > span > span.next-select-values.next-input-text-field")
page.fill("#ae-search-select-1", i)
page.click("body > div.next-overlay-wrapper.opened > div.next-overlay-inner.next-dialog-container > div > div.next-dialog-body > div > div.address > span > div > div > div > ul > li:nth-child(1) > div")
with page.expect_navigation():
page.click("body > div.next-overlay-wrapper.opened > div.next-overlay-inner.next-dialog-container > div > div.next-dialog-footer.next-align-center > button")
print(page.inner_text("#root > div > div.product-main > div > div.product-info > div.product-price > div.product-price-current > span"))
browser.close()
复制代码
暴力通过选择器点击,
[attach]133788[/attach]
卡在点击apply的时候,自己点击就会继续运行,直到再次卡住。
[attach]133789[/attach]
没搞懂为什么会卡住。超时后报错
[attach]133790[/attach]
作者:
海海豚
时间:
2021-8-16 09:53
https://blog.csdn.net/zx520113/article/details/103961128/
参考下
作者:
bellas
时间:
2021-8-16 10:19
参考下这个链接
https://www.zhihu.com/question/264956322
作者:
qqq911
时间:
2021-8-16 11:00
下个断点看看
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2