ruby - Watir 的 browser.refresh 给出“拒绝访问”
问题描述
我正在我的项目中探索 Watir。它在第一次尝试 URL 时工作得很好,但是当我导航到另一个 URL 或者我只是刷新现有的 Watir 的浏览器(通过命令和手动刷新)时,它会显示ACCESS DENIED Please verify you are a human
。
我已经用谷歌搜索了这个并在我的代码中添加了无头,但这没有用。
这就是我在 Rails 控制台中尝试的内容:
# Headless initialized and started
> headless = Headless.new
> headless.start
# Watir object initialized and navigated
> browser = Watir::Browser.new
> browser.goto 'https://www.pepboys.com/'
# Typed `browser` in console, got the output
> browser
`WARN Selenium [DEPRECATION] Selenium::WebDriver::Error::NoAlertPresentError is deprecated. Use Selenium::WebDriver::Error::NoSuchAlertError (ensure the driver supports W3C WebDriver specification) instead.
=> #<Watir::Browser:0x..f80f33b9a75f7d034 url="https://www.pepboys.com/" title="**Pep Boys Tires, Auto Parts, Auto Repair & Service and Car Accessories**">`
# Now when refreshing `browser`
> browser.refresh
# Typed `browser` in console, got the output
> browser
`WARN Selenium [DEPRECATION] Selenium::WebDriver::Error::NoAlertPresentError is deprecated. Use Selenium::WebDriver::Error::NoSuchAlertError (ensure the driver supports W3C WebDriver specification) instead.
=> #<Watir::Browser:0x..f80f33b9a75f7d034 url="https://www.pepboys.com/" title="**Access to this page has been denied.**">`
两者browser
都有不同的标题,其中一个给出站点的标题,另一个给出拒绝访问的消息。
拜托,谁能帮我解决我在这里做错了什么或遗漏了什么?
解决方案
推荐阅读
- node.js - 如何使用 vue js 作为前端和 postgres 作为后端创建节点 js 应用程序
- java - 替换 @Autowired Httpservlet 为什么在 springbok 中自动装配 httpservlet 不是一个好习惯?
- node.js - UTF-8 SQL 搜索
- linux - 根据列的值保留唯一 ID?
- f# - 如何在 F# 中为自定义类型定义一元减号?
- c# - 跳过等待任务响应条件
- hadoop - Hadoop mover 太慢了
- bash - 如何在mailx中插入名称字段
- python - Python/gspread - 用不同的值更新多个单元格?
- python - 如何计算每次迭代的平均值?