My code is:
import unittest
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.common import desired_capabilities
class test_mycode(unittest.TestCase):
def setUp(self):
desired_cap = {'browser': 'IE', 'browser_version': '8.0', 'os': 'Windows', 'os_version': '7', 'resolution': '1366x768'}
self.driver = webdriver.Remote(command_executor='http://username:ACCESS_KEY@hub.browserstack.com:80/wd/hub', desired_capabilities=desired_cap)
def test_website(self):
.....
Mistake:
Traceback (most recent call last):
File "C:\Workspace\Pumpkin Patch Website\test cases\_test_mycode.py", line 55, in setUp
desired_capabilities=desired_cap)
File "C:\Users\elton.tiong\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium-2.48.0-py3.5.egg\selenium\webdriver\remote\webdriver.py", line 87, in __init__
self.start_session(desired_capabilities, browser_profile)
File "C:\Users\elton.tiong\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium-2.48.0-py3.5.egg\selenium\webdriver\remote\webdriver.py", line 141, in start_session
'desiredCapabilities': desired_capabilities,
File "C:\Users\elton.tiong\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium-2.48.0-py3.5.egg\selenium\webdriver\remote\webdriver.py", line 201, in execute
self.error_handler.check_response(response)
File "C:\Users\elton.tiong\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium-2.48.0-py3.5.egg\selenium\webdriver\remote\errorhandler.py", line 102, in check_response
value = json.loads(value_json)
File "C:\Users\elton.tiong\AppData\Local\Programs\Python\Python35-32\lib\json\__init__.py", line 319, in loads
return _default_decoder.decode(s)
File "C:\Users\elton.tiong\AppData\Local\Programs\Python\Python35-32\lib\json\decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\elton.tiong\AppData\Local\Programs\Python\Python35-32\lib\json\decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
selenium-server-standalone2.48.0 is installed and running.
Python - 3.5
This is the code I wrote to run Selenium in a browser. I followed the instructions given by the browser, however, when I started it, it raised a JSONDecodeError.
I also changed command_executor to http : //127.0.0.1-00-00444/wd/hub , but that failed. Then I changed the desire_capabilities = wish_cap property to the desired .DesireCapabilities.FIREFOX qualities, but it also crashed.
I googled everywhere but can't find any answer. Can someone help? Thank you very much.