zoukankan      html  css  js  c++  java
  • selenium报错问题解决方法

    DevTools listening on ws://127.0.0.1
    不停的提示,虽然不影响程序的运行.可总是看些烦心. 搜了许久,找到这个方法.记录在这里,以备忘了来查
    options = webdriver.ChromeOptions()
    options.add_experimental_option('excludeSwitches', ['enable-logging'])
    self.browser = webdriver.Chrome(options = options)

     问题是不报错了,但是无法输入url了。。。。。。。。。。。。。。

    driver.get()这个操作,阻塞了,程序一直停着不动

    原理非常简单:driver.get()这个操作,改成不阻塞的就行了,这样打开网页就操作完成了,不需要等他加载

    下面我可以直接等待需要的元素出现即可进行操作

    配置也是很简单

    复制代码
    from selenium import webdriver
    from selenium.webdriver.common.desired_capabilities import DesiredCapabilities


    #get直接返回,不再等待界面加载完成
    desired_capabilities = DesiredCapabilities.CHROME
    desired_capabilities["pageLoadStrategy"] = "none"

    driver = webdriver.Chrome(executable_path='chromedriver.exe')
    复制代码
    配置一个参数,就是页面加载策略,系统默认是等待,就是等他加载完,直接设置成none,就是不等待,这样就是get操作完后直接就是结束了

    不影响下面的操作,这样就可以愉快的玩耍了

  • 相关阅读:
    nginx安装配置: configure命令
    nginx最简安装
    进程上下文切换
    九卷读书:《操作系统设计与实现》读书笔记
    计算机存储器的层次结构
    线程,进程和并发
    理解Flight框架核心
    Ubuntu16.04安装QQ机器人
    微信支付解决方案
    springboot +nginx +freemarker 模板的简单集成
  • 原文地址:https://www.cnblogs.com/Aline2/p/13458436.html
Copyright © 2011-2022 走看看