我需要在 Firefox Mobile 中运行 Selenium 测试。有人能描述一个简单的方法来做到这一点吗?我的调查表明:
- Firefox 移动版不受支持Appium (one, two).
- Firefox Desktop has built-in Responsive Design Mode like shown on the picture:
- 看起来壁虎司机不支持 Firefox 移动版。相比Chrome驱动程序Geckodriver 没有特定于移动设备的代码。
- There is(或者有)某种方法可以使用 Firefox 首选项打开移动模拟。它的工作原理是使用 Marionette API 调用将 Firefox 从 CONTENT 切换到 CHROME 上下文,然后使用 Selenium 按键盘快捷键。
这些解决方案均未取得成功。知道如何自动化 Firefox Mobile 吗?
您可以尝试使用 Geckodriver 并更改用户代理和设备大小(宽度和高度)在 FireFox 桌面应用程序上模拟它。以下是 Python 3 中的示例:
user_agent = "Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16"
profile = webdriver.FirefoxProfile()
profile.set_preference("general.useragent.override", user_agent)
driver = webdriver.Firefox(profile)
driver.set_window_size(360,640)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)