0

I'm trying to do something very easy with BrowserStack using selenium and python 3. Let's say this is my capability:

caps =
[
  {
    'os_version': '10',
    'os': 'Windows',
    'browser': 'chrome',
    'browser_version': '96.0',
    'name': 'Parallel Test1',  # test name
    'build': 'browserstack-build-1'  # Your tests will be organized within this build
  }
]

Now, say all I want to do is to visit google. Here is the code:

driver = webdriver.Remote(command_executor='https://myBrowserStackCode',desired_capabilities=caps[1])
driver.get("https://www.google.com")
driver.quit()
 

It does work, but desired_capabilities has been deprecated, and I get asked to 'pass in an Options object with options kwarg'. I don't know what that means. Should I go with something like this?

options=webdriver.ChromeOptions()

How am I supposed to pass caps then? What if I had more than one cap in the caps, each with different browsers?

tajir12457
  • 153
  • 1
  • 11
  • "and I get asked to 'pass in an Options object with options kwarg'. I don't know what that means." Well, what does the documentation say? " Should I go with something like this?" That certainly looks like what was described, yes. "How am I supposed to pass caps then?" Well, did you try reading the documentation for the `webdriver.ChromeOptions` class? "What if I had more than one cap in the caps, each with different browsers?" Just... make more than one `Options` object and choose from them, the same way you choose from the caps dicts now? I don't see the problem. – Karl Knechtel Dec 08 '21 at 20:42
  • @KarlKnechtel I read the documents, still don't seem to be smart enough! Say I have this: chrome_options = webdriver.ChromeOptions(). How can I pass a predefined cap to it? I'm talking about caps[1]. – tajir12457 Dec 08 '21 at 21:10
  • Please see the linked duplicate. – Karl Knechtel Dec 09 '21 at 03:04

0 Answers0