You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
import re |
|
|
from playwright.sync_api import Playwright, sync_playwright, expect |
|
|
|
|
|
|
|
|
def run(playwright: Playwright) -> None: |
|
|
browser = playwright.chromium.launch(headless=False) |
|
|
context = browser.new_context() |
|
|
page = context.new_page() |
|
|
page.goto("https://www.jd.com/") |
|
|
page.get_by_role("link", name="你好,请登录").click() |
|
|
page.get_by_placeholder("账号名/手机号/邮箱").click() |
|
|
page.get_by_placeholder("账号名/手机号/邮箱").fill("18611659484") |
|
|
page.get_by_placeholder("账号名/手机号/邮箱").press("Tab") |
|
|
page.get_by_placeholder("密码").fill("Rog129Sunx1532") |
|
|
page.get_by_role("link", name="登 录").click() |
|
|
page.locator(".JDJRV-slide-bg > div:nth-child(3)").click() |
|
|
page.locator(".JDJRV-slide-bg > div:nth-child(3)").click() |
|
|
page.locator(".JDJRV-slide-bg > div:nth-child(3)").click() |
|
|
page.get_by_text("向右滑动完成拼图").click() |
|
|
page.locator(".JDJRV-slide-bg > div:nth-child(3)").click() |
|
|
page.locator("#JDJRV-wrap-loginsubmit a").first.click() |
|
|
|
|
|
# --------------------- |
|
|
context.close() |
|
|
browser.close() |
|
|
|
|
|
|
|
|
with sync_playwright() as playwright: |
|
|
run(playwright)
|
|
|
|