Error forwarding the new session cannot find : Capabilities [{browserName=htmlun

本文介绍了一种在使用Selenium WebDriver进行自动化测试时遇到的问题,当浏览器类型设置为HtmlUnit时,启动会报错。文章提供了错误信息及解决方法,即在启动selenium-server-node时需指定HtmlUnit。

代码:

driver = webdriver.Remote(
                                          command_executor=' http://127.0.0.1:4444/wd/hub',
                                          desired_capabilities={'platform': 'ANY',
                                          'browserName': 'htmlunit',
                                          'version': '',
                                          'javascriptEnabled': True
                                         })

运行的时候报:selenium.common.exceptions.WebDriverException: Message:

Error forwarding the new session cannot find : Capabilities [{browserName=htmlunit, javascriptEnabled=true, version=, platform=ANY}]

当时有点迷惑,我把 'browserName': ''的value换成chrome.firefox,IE都没有问题,就这个htmlunit报错,查资料发现这个在启动selenium-server node的时候要指定一下

java -jar selenium-server-standalone-2.44.0.jar -role node -hub http://IP:4444/grid/register  -browser  browserName=htmlunit   
 

 

2025-09-12 15:21:26.090 [boundedElastic-1] ERROR c.g.g.h.GatewayExceptionHandler - [handle,52] - [网关异常处理]请求路径:/agent/pointcs/limit/setting,异常信息:503 SERVICE_UNAVAILABLE "Unable to find instance for gcvcloud-interface-service" 2025-09-12 15:21:48.487 [reactor-http-nio-3] ERROR c.g.g.h.GatewayExceptionHandler - [handle,52] - [网关异常处理]请求路径:/synthesize/list,异常信息:JWT strings must contain exactly 2 period characters. Found: 0 2025-09-12 15:22:10.447 [reactor-http-nio-3] ERROR c.g.g.h.GatewayExceptionHandler - [handle,52] - [网关异常处理]请求路径:/synthesize/list,异常信息:Unable to read JSON value: �z��&�r#�$�3S" 2025-09-12 15:22:11.214 [reactor-http-nio-3] ERROR c.g.g.h.GatewayExceptionHandler - [handle,52] - [网关异常处理]请求路径:/synthesize/list,异常信息:Unable to read JSON value: �z��&�r#�$�3S" 2025-09-12 15:25:09.460 [reactor-http-nio-3] ERROR c.g.g.h.GatewayExceptionHandler - [handle,52] - [网关异常处理]请求路径:/module/experimentalSite/list,异常信息:404 NOT_FOUND 2025-09-12 15:27:16.749 [reactor-http-nio-3] ERROR c.g.g.h.GatewayExceptionHandler - [handle,52] - [网关异常处理]请求路径:/module/experimentalSite/list,异常信息:404 NOT_FOUND 2025-09-12 15:27:43.360 [reactor-http-nio-3] ERROR c.g.g.h.GatewayExceptionHandler - [handle,52] - [网关异常处理]请求路径:/module/experimentalSite/list,异常信息:404 NOT_FOUND 什么错误? 网关配置如下 spring: redis: host: localhost port: 6379 password: cloud: gateway: globalcors: corsConfigurations: '[/**]': #allowedOriginPatterns: "http://10.30.80.42,http://localhost:8080,http://10.30.80.42:8080,http://localhost:820" allowedOriginPatterns: "*" allowed-methods: "*" allowed-headers: "*" allow-credentials: true exposedHeaders: "Content-Disposition,Content-Type,Cache-Control" discovery: locator: lowerCaseServiceId: true enabled: true routes: # 认证中心 - id: gcvcloud-auth uri: lb://gcvcloud-auth predicates: - Path=/auth/** filters: # 验证码处理 - CacheRequestFilter - ValidateCodeFilter - StripPrefix=1 # 代码生成 - id: gcvcloud-gen uri: lb://gcvcloud-gen predicates: - Path=/code/** filters: - StripPrefix=1 # 定时任务 - id: gcvcloud-job uri: lb://gcvcloud-job predicates: - Path=/schedule/** filters: - StripPrefix=1 # 系统模块 - id: gcvcloud-system uri: lb://gcvcloud-system predicates: - Path=/system/** filters: - StripPrefix=1 # 文件服务 - id: gcvcloud-file uri: lb://gcvcloud-file predicates: - Path=/file/** filters: - StripPrefix=1 # 预算管理 - id: gcvcloud-budget uri: lb://gcvcloud-budget predicates: - Path=/budget/** filters: - StripPrefix=1 # 应用管理 - id: gcvcloud-organization uri: lb://gcvcloud-organization predicates: - Path=/organization/** filters: - StripPrefix=1 # 数据报表 - id: gcvcloud-datareport uri: lb://gcvcloud-datareport predicates: - Path=/datareport/** filters: - StripPrefix=1 # 运营预算 - id: gcvcloud-operate uri: lb://gcvcloud-operate predicates: - Path=/operate/** filters: - StripPrefix=1 # 积木报表 - id: gcvcloud-jimureport uri: lb://gcvcloud-jimureport predicates: - Path=/jove-report/** filters: - StripPrefix=1 # 邮箱模块 - id: gcvcloud-mail uri: lb://gcvcloud-mail predicates: - Path=/mail/** filters: - StripPrefix=1 # 邮箱模块 - id: gcvcloud-conference uri: lb://gcvcloud-conference predicates: - Path=/conference/** filters: - StripPrefix=1 # bom成本构建 - id: gcvcloud-bom uri: lb://gcvcloud-bom predicates: - Path=/bom/** filters: - StripPrefix=1 - name: BlackListUrlFilter args: blacklistUrl: - 10.200. - 10.255. # 工作流构建 - id: gcvcloud-activiti uri: lb://gcvcloud-activiti predicates: - Path=/danny/** filters: - StripPrefix=1 # 任务协同 - id: gcvcloud-tasksynergy uri: lb://gcvcloud-tasksynergy predicates: - Path=/tasksynergy/** filters: - StripPrefix=1 # 综合管理 - id: gcvcloud-synthesize uri: lb://gcvcloud-synthesize predicates: - Path=/synthesize/** filters: - StripPrefix=1 #试制bom - id: gcvcloud-trial-bom uri: lb://gcvcloud-trial-bom predicates: - Path=/trialbom/** filters: - StripPrefix=1 - name: BlackListUrlFilter args: blacklistUrl: - 10.200. - 10.255. # 零部件parts - id: gcvcloud-parts uri: lb://gcvcloud-parts predicates: - Path=/parts/** filters: - StripPrefix=1 # 阀点 - id: gcvcloud-valvepoint uri: lb://gcvcloud-valvepoint predicates: - Path=/valvepoint/** filters: - StripPrefix=1 # 人才管理系统 - id: gcvcloud-talent-management uri: lb://gcvcloud-talent-management predicates: - Path=/talent/** filters: - StripPrefix=1 #重点工作 - id: gcvcloud-workrating uri: lb://gcvcloud-workrating predicates: - Path=/work/** filters: - StripPrefix=1 #投票应用 - id: gcvcloud-vote uri: lb://gcvcloud-vote predicates: - Path=/vote/** filters: - StripPrefix=1 #集成sap服务 - id: gcvcloud-sap-server uri: lb://gcvcloud-sap-server predicates: - Path=/sapserver/** filters: - StripPrefix=1 #评分服务 - id: gcvcloud-gcvgrade uri: lb://gcvcloud-gcvgrade predicates: - Path=/gcvgrade/** filters: - StripPrefix=1 #工作流服务 - id: gcvcloud-workflow uri: lb://gcvcloud-workflow predicates: - Path=/workflow/** filters: - StripPrefix=1 #数字化知识应用平台 - id: gcvcloud-dkap uri: lb://gcvcloud-dkap predicates: - Path=/dkap/** filters: - StripPrefix=1 #商研伯乐 - id: gcvcloud-sybl uri: lb://gcvcloud-sybl predicates: - Path=/sybl/** filters: - StripPrefix=1 # 企微管理 - id: gcvcloud-wechat uri: lb://gcvcloud-wechat predicates: - Path=/qw/** filters: - StripPrefix=1 # 产品型谱 - id: gcvcloud-spectrum uri: lb://gcvcloud-spectrum predicates: - Path=/spectrum/** filters: - StripPrefix=1 - id: gcvcloud-interface-service uri: lb://gcvcloud-interface-service predicates: - Path=/agent/** filters: - StripPrefix=1 - id: gcvcloud-vpm uri: lb://gcvcloud-vpm predicates: - Path=/vpm/** filters: - StripPrefix=1 # 安全配置 security: # 验证码 captcha: enabled: false type: math # 防止XSS攻击 xss: enabled: true excludeUrls: - /system/notice - /jove-report/jmreport/** - /danny/sale/** - /danny/weekly/** - /danny/projectInfo/updateProjectCurrentProgress - /danny/projectMeeting/** # 不校验白名单 ignore: whites: - /wechat/do - /wechat/login - /auth/ssoLogin - /auth/code - /auth/logout/** - /auth/login - /auth/loginByPlaintext - /auth/register - /auth/getPublicKey - /*/v2/api-docs - /csrf - /organization/list - /organization/selectAll - /organization/listFile - /organization/fileManagementTree - /organization/filemanagement/selectFileAll - /jove-report/** - /conference/conference/** - /conference/person/** - /conference/qiandaoma - /conference/qiandaoma/s/** - /conference/qiandaoma/d/** - /danny/processDefinition/addDeploymentByString - /danny/processDefinition/upload - /danny/processDefinition/getDefinitionXML - /danny/timely/createTask - /danny/task/getTasksCount - /trialbom/integration/querySrmSuppliers - /system/dept/deptListToFmea - /system/score - /danny/getVariables - /danny/projectInfo/pushProjectInfo/** - /work/openApi/** - /danny/projectInfo/getProjectCodeForProjectNo - /parts/openApi/** - /danny/projectInfo/api/** - /danny/integration/** - /qw/wechat/** - /trialbom/integration/addDbom - /file/getDownLoadPathList - /interface/** - /agent/** - /danny/openApi/**
最新发布
09-13
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值