Airtext连接chrome谷歌浏览器报错

Airtext连接chrome报错

近期在使用AirtestIDE连接chrome的时候,发现可以正常打开浏览器进行录制,在识别控件的时候也可以正常识别,但是运行录制好的脚本的时候会报错如下:

javascript 复制代码
[Start running..]
do not connect device
save log in '\AirtestIDE\scripts\d91e047757e8c18b825a54eda6bb8efd'
[10:20:53][ERROR]<airtest.core.api> Traceback (most recent call last):
  File "airtest\cli\runner.py", line 72, in runTest
  File "\fx.air\fx.py", line 8, in <module>
    driver.get("www.baidu.com")
  File "airtest\utils\logwraper.py", line 124, in wrapper
  File "\AirtestIDE-win-1.2.15\AirtestIDE\airtest_selenium\proxy.py", line 287, in get
    super(WebChrome, self).get(address)
  File "\AirtestIDE-win-1.2.15\AirtestIDE\selenium\webdriver\remote\webdriver.py", line 333, in get
    self.execute(Command.GET, {'url': url})
  File "\AirtestIDE-win-1.2.15\AirtestIDE\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "\AirtestIDE-win-1.2.15\AirtestIDE\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: unhandled inspector error: {"code":-32000,"message":"Cannot navigate to invalid URL"}
  (Session info: chrome=110.0.5481.178)
  (Driver info: chromedriver=2.37.544315 (730aa6a5fdba159ac9f4c1e8cbc59bf1b5ce12b7),platform=Windows NT 10.0.19044 x86_64)
======================================================================
ERROR: runTest (app.widgets.code_runner.ide_launcher.AirtestIDECase)
----------------------------------------------------------------------

在窗口上也有一条warning:

javascript 复制代码
UserWarning: DOM.describeNode error: Could not find node with given id

经过检查发现,Airtest封装是带有chromedriver,只是版本比较旧,基础打开chrome跟控件识别还是可以的,但是在运行脚本的时候就会报错。

想要正常使用airtest-selenium去编写chrome的脚本时,目前可以参考这篇文章所提供的chrome版本,并下载对应的chromedriver,这样就可以很好的运行啦~

下载好了对应的chromedriver之后,可以到本地查看chrome的地址,将对应版本的chromedriver放到chrome的所属文件夹下,如下图:

如果还有不清楚的地方,可以参考这篇教程噢~

目前浏览器只兼容了chrome的部分版本以及Firefox这两个浏览器,更高版本的chrome以及ie的兼容我们也在快马加鞭的更新中~

相关推荐
winfredzhang1 小时前
从零构建:手写一个支持“高度定制化排版”的 Chrome 网页摘录插件
chrome·pdf·插件·epub·零碎信息归档
祎直向前2 小时前
linuxshell测试题
前端·chrome
天才测试猿3 小时前
软件测试之bug分析定位技巧
软件测试·python·selenium·测试工具·职场和发展·测试用例·bug
祎直向前4 小时前
linuxshell循环,条件分支语句
前端·chrome
扉间79817 小时前
合并后的项目 上传分支 取哪里的东西提交
大数据·chrome·elasticsearch
爆更小哇18 小时前
Selenium自动化测试函数全解析(二)
java·selenium·测试工具·自动化
扉间79820 小时前
lightrag嵌入思路
前端·chrome
Benny的老巢1 天前
用 Playwright 启动指定 Chrome 账号的本地浏览器, 复用原账号下的cookie信息
前端·chrome
程序员小远1 天前
UI自动化测试框架:PO模式+数据驱动
自动化测试·软件测试·python·selenium·测试工具·职场和发展·测试用例
@杨某1 天前
超级鹰的使用
爬虫·selenium