zoukankan      html  css  js  c++  java
  • deepin15.11+python3.5.3+selenium (3.141.0)配置HTMLUNIT模式

    deepin15.11+python3.5.3+selenium (3.141.0)配置HTMLUNIT模式

    一、安装JAVA环境

    java -version
    java version "1.8.0_251"
    Java(TM) SE Runtime Environment (build 1.8.0_251-b08)
    Java HotSpot(TM) 64-Bit Server VM (build 25.251-b08, mixed mode)
    

    二、下载selenium-server-standalone-xxx.jar

    1. 查看环境selenium版本

    pip3 list | grep selenium
    selenium (3.141.0)
    

    2. 下载对应版本的jar包
    selenium官网链接
    下载路径

    wget http://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.0.jar
    

    问题:
    不知道为什么下载的selenium-server-standalone-3.141.0.jar无法使用
    报错Driver info: driver.version: unknown
    后来阴差阳错下载了selenium-server-standalone-3.14.0.jar竟然能用(心态崩了)

    3.14.0版本下载

    wget http://selenium-release.storage.googleapis.com/3.14/selenium-server-standalone-3.14.0.jar
    

    三、启动selenium-server-standalone-xxx.jar

    启动3.141.0版本

    java -jar selenium-server-standalone-3.141.0.jar
    

    启动3.14.0版本

    java -jar selenium-server-standalone-3.14.0.jar
    

    四、执行python脚步

    #!/usr/bin/python3
    # -*- condig:utf-8 -*-
    from selenium import webdriver
    from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
    
    htmlunit = webdriver.Remote(desired_capabilities=webdriver.DesiredCapabilities.HTMLUNIT)
    htmlunit.get("http://www.baidu.com")
    print(htmlunit.title)
    

    结果:
    百度一下,你就知道

    诡异问题

    selenium-server-standalone-3.14.0.jar版本执行脚本时报错:
    Driver info: driver.version: unknown
    在官网下载selenium-server-standalone-3.14.0.jar包时误将3.14.0版本下载后执行脚步竟然成功了,也不清楚问题出在哪了
    selenium官网

  • 相关阅读:
    CF57C Array
    P4739 [CERC2017]Donut Drone
    CF1455D Sequence and Swaps
    LG P4351 [CERC2015]Frightful Formula
    5. React-router1- react-router理解
    5. React-router0- spa理解和路由的理解
    axios案例学习总结
    axios源码和常用方法
    http8种请求方式
    axios-http,ajax的封装,axios的使用
  • 原文地址:https://www.cnblogs.com/jingxindeyi/p/12996087.html
Copyright © 2011-2022 走看看