在 Watir 中创建新窗口

发布于 2025-01-04 00:55:20 字数 456 浏览 2 评论 0原文

我是新来的。我正在尝试创建新的 ie 窗口,

browser = Watir::Browser.new

但它给出了错误消息,就像

`user_is_bewildered': Error in the default values: :browser's value must be one of 'ie', 'firefox', or 'safari', and '' doesn't look right. (StandardError)

我不知道如何设置默认浏览器一样。有人可以帮助我吗? 此处还有另一个线程。但我无法理解我需要在 ffi 做什么。

谢谢

I am new to watir. I am trying to create new ie window with

browser = Watir::Browser.new

but it gives error message like

`user_is_bewildered': Error in the default values: :browser's value must be one of 'ie', 'firefox', or 'safari', and '' doesn't look right. (StandardError)

I donno how to set default browser. Can some one help me? There is a another thread here. But I am not able to understand what i need to do in ffi.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

烂柯人 2025-01-11 00:55:20

如果这是原始的 Watir gem,那么以下是我用来启动它的方式:

require 'rubygems'
require 'watir'

Watir::Browser.default = "firefox"
browser = Watir::Browser.new

# Whatever you want to do in watir

IamChuckB 的答案可能是一种更有效的方法,但我不确定是否使用过它。

If this is the original Watir gem, then the following is how I used to launch it:

require 'rubygems'
require 'watir'

Watir::Browser.default = "firefox"
browser = Watir::Browser.new

# Whatever you want to do in watir

IamChuckB's answer may be a more efficient way of doing this, but having not used it, I'm not sure.

不忘初心 2025-01-11 00:55:20

您需要告诉它要打开哪个浏览器。试试这个:

browser = Watir::Browser.new :ff

自从我上一份工作以来,我就没有玩过 watir,所以我必须查一下这个。我上次记得,WATIR 并未与 FireWATIR(基于 Firefox 的变体)完全集成。很高兴看到两人同时显然已经和解了。

摘自五分钟内的瓦提尔 在 Zeljko Filipin 的 github 上,顺便说一句。

You need to tell it which browser to open. Try this:

browser = Watir::Browser.new :ff

I haven't played around with watir since my last job so I had to look this up. As I last recall, WATIR was not entirely integrated with FireWATIR (the Firefox based variant). It's good to see that the two have apparently been reconciled in the meantime.

Taken from Watir in Five Minutes on Zeljko Filipin's github, BTW.

放低过去 2025-01-11 00:55:20

要安装 devkit,

  1. 请在 ruby​​ 目录中创建一个名为 devkit 的文件夹,
  2. 此处
  3. 将其解压到步骤 1 中创建的 devkit 目录中
  4. 添加c:\ruby193\devkit\bin;c:\ruby193\devkit\wming\bin 到你的路径,当然调整你的 ruby​​ 安装目录

现在打开命令提示符再次安装 gem

c:\> gem install watir

To install devkit,

  1. create a folder in the ruby directory called devkit
  2. get the devkit from here
  3. unpack it into the devkit directory created in step 1
  4. add c:\ruby193\devkit\bin;c:\ruby193\devkit\wming\bin to your path, of course adjusting for your ruby install directory

now open a command prompt to install the gem again

c:\> gem install watir
热情消退 2025-01-11 00:55:20

问题已解决。感谢您的投入。问题是 nokorigi gem 安装错误,最初我安装了 x86-mswin32-60,我卸载了它并尝试使用 x86-mingw32,它解决了。

The issue is resolved. Thanx for the the inputs. The issue was with wrong nokorigi gem installation, initially i installed x86-mswin32-60, i uninstalled it and tried with x86-mingw32, it solved.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文