TA的每日心情 无聊 昨天 09:47
签到天数: 528 天
连续签到: 1 天
[LV.9]测试副司令
1 测试积点
代码如下
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()
复制代码 暴力通过选择器点击,
卡在点击apply的时候,自己点击就会继续运行,直到再次卡住。
没搞懂为什么会卡住。超时后报错
我来回答