最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

selenium webdriver - WebDriverException: Message: Error : Platform and Browser not valid - Stack Overflow

programmeradmin0浏览0评论

Trying to connect to browserStack automation with the following but getting an error: WebDriverException: Message: Error : Platform and Browser not valid.

from appium.options.android import UiAutomator2Options

def my_test(self):

    options = UiAutomator2Options()
    options.set_capability("platformName", "android")
    options.set_capability("deviceName", "Google Pixel 7")
    options.set_capability("platformVersion", "13.0")
    options.set_capability("browserName", "Chrome")

    server= "hub-cloud.browserstack/wd/hub"

    self.driver = webdriver.Remote(command_executor=f"https://{my_user_name}:{my_access_key}@{server}", options=options)

    self.driver.get("https//www.example")

    self.driver.quit()

Trying to connect to browserStack automation with the following but getting an error: WebDriverException: Message: Error : Platform and Browser not valid.

from appium.options.android import UiAutomator2Options

def my_test(self):

    options = UiAutomator2Options()
    options.set_capability("platformName", "android")
    options.set_capability("deviceName", "Google Pixel 7")
    options.set_capability("platformVersion", "13.0")
    options.set_capability("browserName", "Chrome")

    server= "hub-cloud.browserstack/wd/hub"

    self.driver = webdriver.Remote(command_executor=f"https://{my_user_name}:{my_access_key}@{server}", options=options)

    self.driver.get("https//www.example")

    self.driver.quit()
Share asked Mar 3 at 21:26 Testing SinghTesting Singh 1,3631 gold badge15 silver badges27 bronze badges 1
  • If you are using BrowserStack, they have examples of how to do this in their documentation. If it's still not working, you can open a ticket and get help directly from the company. – JeffC Commented Mar 3 at 23:14
Add a comment  | 

1 Answer 1

Reset to default 1

Read the error carefully! - it says that the platform and browser are not valid. So that means the ones you have provided are either spelled wrong or do not exist.

Go to browserstack and look at the list of available devices they have and make sure that they match exactly to what you provided in the options object.

You can also use this capability generator that allows you to experiment with what they have -> https://www.browserstack/docs/app-automate/capabilities

发布评论

评论列表(0)

  1. 暂无评论