How to find a browser's command_executor string in Heroku

允我心安 提交于 2020-01-16 19:42:30

问题


I've run into the following problem while attempting to emulate a mobile browser with chrome on heroku: Selenium ERR_NAME_NOT_RESOLVED on heroku with mobile testing. Based on Josh Lewis's answer, and the python code sample at https://sites.google.com/a/chromium.org/chromedriver/mobile-emulation

from selenium import webdriver
mobile_emulation = { "deviceName": "Nexus 5" }
chrome_options = webdriver.ChromeOptions()
chrome_options.add_experimental_option("mobileEmulation", mobile_emulation)
driver = webdriver.Remote(command_executor='http://127.0.0.1:4444/wd/hub',
                  desired_capabilities = chrome_options.to_capabilities())

It may be that I need to use a command_executor (defined at https://seleniumhq.github.io/selenium/docs/api/py/webdriver_remote/selenium.webdriver.remote.webdriver.html) as

command_executor - Either a string representing URL of the remote server or a 
custom
remote_connection.RemoteConnection object. Defaults to 
‘http://127.0.0.1:4444/wd/hub'

to get my code working. How would I found this with the Heroku chrome buildpack, https://github.com/heroku/heroku-buildpack-google-chrome

edit:

You can download my project for both windows and heroku use at:

https://github.com/kc1/mobiletest

(keep in mind that if you deploy to heroku you have to set FLASK_CONFIG to production. )

来源:https://stackoverflow.com/questions/51484680/how-to-find-a-browsers-command-executor-string-in-heroku

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!