爬虫模拟登录1 问题版

import time #时间模块
from bs4 import BeautifulSoup #数据筛选 网页选择器
from selenium import webdriver #测试框架
from selenium.webdriver.support.ui import WebDriverWait #浏览器等待完成的包
#爬虫流程 面向对象
class Taobao_Infos:
    #魔术方法 构造方法
    def __init__(self):
        url = 'https://login.taobao.com/member/login.jhtml'
        #self 类属性的作用可以共用
        self.url = url
        self.broswer = webdriver.Firefox(executable_path='../data/geckodriver.exe')
        self.wait = WebDriverWait(self.broswer,10)
#登录 类方法
    def login_Infos(self):
        #控制浏览器去打开淘宝登录网页
        self.broswer.get(self.url,ips)
        if self.broswer.find_element_by_xpath('//*[@id="fm-login-id"]'):
            user = self.broswer.find_element_by_xpath('//*[@id="fm-login-id"]')
            user.send_keys('xxxxxx')
            time.sleep(5)
        if self.broswer.find_element_by_xpath('//*[@id="fm-login-password"]'):
            password = self.broswer.find_element_by_xpath('//*[@id="fm-login-password"]')
            password.send_keys('xxxxxx')
            time.sleep(6)        
        
        
        submit = self.broswer.find_element_by_xpath('/html/body/div/div[2]/div[3]/div/div/div/div[2]/div/form/div[4]/button')
        submit.click()shao
        time.sleep(5)
Taobao_Infos().login_Infos()    
      

问题在于,出现了滑动验证,以及submit的xpath出现了错误,
这里我称为易位,针对滑动验证解决思路:1、建立ip池 2、模拟支付宝或者微博登录 针对易位:打算再找点案例

重新学爬虫的第4天
简单笔记用于自己的思路总结,有大佬么求带!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值