代码语言:javascript复制
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
'''创建谷歌浏览器对象'''
goolge=webdriver.Chrome()
'''访问网站-注册功能'''
goolge.get('https://shop.lovehifi.com/member.php?mod=register')
'''开始同意阅读协议'''
d=goolge.find_element(by=By.XPATH,value='//*[@id="fwin_dialog"]/table/tbody/tr[2]/td[2]/p/button[1]').click()
time.sleep(1)
'''输入用户名'''
goolge.find_element(by=By.XPATH,value='//*[@id="usahfas"]').send_keys('测试')
time.sleep(1)
'''创建密码'''
password='123456789' 'asd'
'''输入密码'''
goolge.find_element(by=By.XPATH,value='//*[@id="ppiglsdgn"]').send_keys(password)
time.sleep(1)
'''再次输入密码'''
goolge.find_element(by=By.XPATH,value='//*[@id="pkldsajpoiqegng"]').send_keys(password)
time.sleep(1)
'''输入邮箱'''
goolge.find_element(by=By.XPATH,value='//*[@id="eiogjlkdsh"]').send_keys('3266986273@qq.com')
time.sleep(1)
'''输入身份证'''
goolge.find_element(by=By.XPATH,value='//*[@id="field1"]').send_keys('输入你的身份证号')
time.sleep(1)
'''嗨嗨嗨'''