问题
- I am Writing scripts for Browserstack using PHP Codeception.
Here it is my acceptance.yml file
modules:
enabled:
- WebDriver
config:
WebDriver:
url: 'http://www.google.com'
host: 'hub.browserstack.com'
port: 80
browser: Android
device: Samsung Galaxy S5
deviceOrientation: portrait
capabilities:
'browserstack.user': 'USERNAME'
'browserstack.key' : 'ACCESS_KEY'
'browserVersion': '21.0'
'browserstack.debug': 'true'
But after run the program through the command line, it will be displaying as below error message in command prompt.
**[Facebook\WebDriver\Exception\UnknownServerException]
Session terminated**
- I will change some script like url: 'http://localhost:8080' and 'browserstack.local': 'false' From the above acceptance.yml file. Then Error being displayed as "Unable to Connect to Server"
Can anyone please give some suggestion to resolve this problem.
回答1:
You need to set the capabilities as follows when executing a test on Android emulators (Samsung Galaxy S5) on BrowserStack:
config:
WebDriver:
url: 'http://www.google.com'
host: 'hub.browserstack.com'
port: 80
browser: android
capabilities:
'browserstack.user': '<username>'
'browserstack.key' : '<automate-key>'
'device': 'Samsung Galaxy S5'
'platform': 'ANDROID'
Note: 'android' for browser
needs to be all lower case and for platform
all upper case.
The Code Generator can be very helpful to specify the capabilities while testing on different browser and OS combinations especially mobile devices.
If you wish to access your local servers on BrowserStack, such as 'http://localhost:8080', you can follow these steps:
a) Setup a Local Testing connection using the binaries.
b) Add the capability 'browserstack.local': 'true'
in your scripts.
来源:https://stackoverflow.com/questions/32559015/unable-to-access-remote-webdriver-to-browserstack-using-codeception