如何更改 Selenium 中的基本 URL

发布于 2024-09-18 11:22:32 字数 365 浏览 3 评论 0原文

我一直在使用 Ruby 中的 Selenium RC 测试基于 Twitter Web 的应用程序。 我想要完成的是: 单击“连接 Twitter”,弹出 Twitter oauth 页面,输入用户名和密码,然后单击“允许”按钮。

但是,当它与 twitter 连接时,它会定向到 twitter oauth 页面,该页面的 URL 与基本 URL 不同。

有什么方法可以更改基本 URL,以便我可以在不同的 url 上执行操作吗? 另外,由于每个twitter oauth页面的URL末尾都有不同的oauth_token,我应该如何设置一个URL,以便它最终可以处理具有不同oauth_token的url?

谢谢您的建议!

问候

直哉

I have been testing a twitter web-based application using Selenium RC in Ruby.
What I want to accomplish is:
Click "Connect with Twitter", pops up the twitter oauth page, type username and password, and click Allow button.

However, when it connects with twitter, it directs to twitter oauth page which is different URL from the base URL.

Is there any way that I can change the base URL so that I can do stuff on different urls?
Also, since each twitter oauth page has a different oauth_token in the end of URL, how should I set a URL such that it can handle urls with different oauth_token in the end?

Thank you for your suggestions!

regards

Naoya

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

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

发布评论

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

评论(1

意中人 2024-09-25 11:22:32

你看到的症状是什么? Selenium 是否抛出 Permission Denied 错误?如果是这样,您可能可以通过使用具有更高安全权限的浏览器启动器来修复它。如果您使用 *iexplore,请尝试使用 *iehta,如果使用 firefox,请尝试使用 *chrome 而不是 *firefox。

例如:

@browser = Selenium::Client::Driver.new \
      :host => "localhost",
      :port => 4444,
      :browser => "*iehta",
      :url => "http://www.google.com",
      :timeout_in_second => 60

这些允许您绕过“同源”安全限制。这样,它们是否具有相同的基本 URL 就无关紧要了。

What's the symptom you're seeing? Is Selenium throwing Permission Denied errors? If so, you could probably fix it by using a browser launcher with heightened security privileges. If you're using *iexplore, try using the *iehta, if using firefox, try *chrome instead of *firefox.

For example:

@browser = Selenium::Client::Driver.new \
      :host => "localhost",
      :port => 4444,
      :browser => "*iehta",
      :url => "http://www.google.com",
      :timeout_in_second => 60

These allow you to circumvent the "Same Origin" security restrictions. This way it won't matter if they have the same base URL.

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