• 自动化测试-鉴权


    问题场景

    当我用selenium进行测试的时候,发现了一个问题,原本不需要鉴权的网页突然需要鉴权了。

     options = new ChromeOptions();
            System.setProperty("webdriver.chrome.driver", "D:\\chromedriver-win64\\chromedriver-win64\\chromedriver.exe");
            options.setPageLoadStrategy(PageLoadStrategy.NONE); // 或 "none"
            driver = new ChromeDriver(options);
    
    • 1
    • 2
    • 3
    • 4

    思路

    我想浏览器的信息应该是共享的,然后使用配置

            options.addArguments("--user-data-dir=C:\\Users\\herche.huo\\AppData\\Local\\Google\\Chrome\\User Data");
    
    
    • 1
    • 2

    果然问题解决,但是引入了新的问题:如果已经打开了浏览器,则会报错。

    (unknown error: DevToolsActivePort file doesn’t exist)
    (The process started from chrome locationxxx is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
    Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:17:03’
    System info: host: ‘LP20230814011’, ip: ‘192.168.16.93’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘1.8.0_152’
    Driver info: driver.version: ChromeDriver
    remote stacktrace: GetHandleVerifier [0x00007FF71AC552A2+57122]
    (No symbol) [0x00007FF71ABCEA92]
    (No symbol) [0x00007FF71AA9E3AB]
    (No symbol) [0x00007FF71AAC6B1F]
    (No symbol) [0x00007FF71AAC2FE1]
    (No symbol) [0x00007FF71AAFEA4F]
    (No symbol) [0x00007FF71AAFE5B0]
    (No symbol) [0x00007FF71AAF6DB3]
    (No symbol) [0x00007FF71AACD2B1]
    (No symbol) [0x00007FF71AACE494]
    GetHandleVerifier [0x00007FF71AEFEF82+2849794]
    GetHandleVerifier [0x00007FF71AF51D24+3189156]
    GetHandleVerifier [0x00007FF71AF4ACAF+3160367]
    GetHandleVerifier [0x00007FF71ACE6D06+653702]
    (No symbol) [0x00007FF71ABDA208]
    (No symbol) [0x00007FF71ABD62C4]
    (No symbol) [0x00007FF71ABD63F6]
    (No symbol) [0x00007FF71ABC67A3]

    通过研究得知,是因为浏览器进程不准有残留。

    结束

    仅仅是一次问题的记录,以便于日后朔源

  • 相关阅读:
    数据库 explain 关键字解析
    ERPS环网络端口角色
    数据结构篇其二---单链表(C语言+超万字解析)
    Android修改分区格式为F2FS
    (附源码)springboot仓库管理系统 毕业设计 260931
    mysql忘记密码的时候重置密码
    java枚举类详解
    当主程架构游戏的时候,防止到处调用减少耦合性,怎么开放接口给其他人调用呢?
    2023-09-27 monetdb-存储架构-记录
    宏观经济学复习题
  • 原文地址:https://blog.csdn.net/weixin_45487988/article/details/132713737