如何为 Java 中运行的 Selenium 测试设置浏览器区域设置?
我一直在寻找 同时 但仍然没有发现任何东西。当我在 Eclipse 中运行 Selenium 测试时,它会打开一个 Firefox 浏览器,该浏览器始终将英语作为默认区域设置。更改默认浏览器设置不会改变 Selenium 打开的每个新浏览器都有英语区域设置的事实。
我在 API 中没有找到任何方法可以将英语以外的语言设置为我的区域设置。我尝试将区域设置设置为 Selenium 服务器的 VM 参数,我尝试将其设置为我的测试。
必须有一些我所缺少的明显方法可以让您轻松获得代表。 :) 有什么想法吗?
I've been looking for a while and still haven't found anything. When I run my Selenium tests from within Eclipse, it opens up a Firefox browser which always has English as its default locale. Changing default browser settings doesn't change the fact that each new browser opened by Selenium has an English locale.
I haven't found any way in the API to set something other than English as my locale. I've tried setting the locale as a VM parameter for the Selenium server, I've tried setting it for my tests.
There's got to be some obvious way of doing this that I'm missing that will result in easy rep for you. :) Any thoughts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我解决这个问题的想法...
创建 Firefox 配置文件并使用 Selenium 打开它们。您可以根据需要修改它们。
Selenium 文档
通过使用特定的配置文件,您可以避免此问题。这不是一个“干净整洁”的解决方案......但它有效......至少对我来说。
My idea to solve this...
Create Firefox Profiles and open them with Selenium. You can modify them for your needs.
Selenium Documentation
By using specific profiles you can avoid this issue. It is not a "nice and clean" Solution..but it works...at least for me.
现在您可以将以下代码片段用于 ChromeDriver(在 Scala 中):
Now you may use the following snippet for ChromeDriver (in Scala):