自动化测试-鉴权

问题场景

当我用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);

思路

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

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

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

(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]

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

结束

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

你可能感兴趣的:(开发Bug,selenium)