TestingBot has full support for this new protocol. Below is more information on how to make this transition.
Updating your tests
With the new W3C protocol, some restrictions apply to using capabilities with your test.
Before the W3C protocol (the so called JSONWP), you could simply add all our custom TestingBot capabilities to your test in the desiredCapabilities.
With the new W3C protocol, only browserName, browserVersion and platformName are allowed inside the capabilities.
All other capabilities are treated as Extension capabilities and should be namespaced, in our case, inside a tb:options namespace.
Please see the table below on how the capabilities need to be changed:
Capability JSONWP
Capability W3C
browserName
browserName
version
browserVersion
platform
platformName
selenium-version, chromedriverVersion, extra, nameand more
importunittestimportsysfromseleniumimportwebdriverfromselenium.webdriver.common.keysimportKeysfromselenium.webdriver.common.desired_capabilitiesimportDesiredCapabilitiesfromtestingbotclientimportTestingBotClientclassTestTestingBotClient(unittest.TestCase):defsetUp(self):desired_cap={'browserName':'chrome','version':'latest-1','platform':'WIN10','screenrecorder':true,'build':'testbuild','name':'testname',}self.driver=webdriver.Remote(command_executor='http://key:secret@hub.testingbot.com/wd/hub',desired_capabilities=desired_cap)deftest_google_example(self):self.driver.get("http://www.google.com")ifnot"Google"inself.driver.title:raiseException("Unable to load google page!")elem=self.driver.find_element_by_name("q")elem.send_keys("TestingBot")elem.submit()deftearDown(self):self.driver.quit()status=sys.exc_info()==(None,None,None)tb_client=TestingBotClient('key','secret')tb_client.tests.update_test(self.driver.session_id,self._testMethodName,status)if__name__=='__main__':unittest.main()
importunittestimportsysfromseleniumimportwebdriverfromselenium.webdriver.common.keysimportKeysfromselenium.webdriver.common.desired_capabilitiesimportDesiredCapabilitiesfromtestingbotclientimportTestingBotClientclassTestTestingBotClient(unittest.TestCase):defsetUp(self):desired_cap={'browserName':'chrome','browserVersion':'latest-1','platformName':'WIN10','tb:options':{'screenrecorder':true,'build':'testbuild','name':'testname','selenium-version':'3.11.0'}}self.driver=webdriver.Remote(command_executor='http://key:secret@hub.testingbot.com/wd/hub',desired_capabilities=desired_cap)deftest_google_example(self):self.driver.get("http://www.google.com")ifnot"Google"inself.driver.title:raiseException("Unable to load google page!")elem=self.driver.find_element_by_name("q")elem.send_keys("TestingBot")elem.submit()deftearDown(self):self.driver.quit()status=sys.exc_info()==(None,None,None)tb_client=TestingBotClient('key','secret')tb_client.tests.update_test(self.driver.session_id,self._testMethodName,status)if__name__=='__main__':unittest.main()