How can I disable Web Driver Exceptions when using the Mozilla Marionette web driver with Selenium
<p>I am remote controlling a Firefox browser using Python and Selenium. I have switched to using Marionette, as directed on the <a href="https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver" rel="nofollow">mozilla developer site</a>. That all works fine. </p>

<p>There is one page, where when I want to select an element. I get an exception. I think it is a Javascript warning that is causing the driver to bork. Does anyone know how I can make the driver less picky about Javascript errors? Additionally does anyone know where there is comprehensive documentation of the Python Marionette client?</p>

<p>Sorry I can't make the code completely reproducible because it is a client's private site that I am attempting to select an element from.</p>

<pre><code>from selenium import webdriver

# see https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver

from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

caps = DesiredCapabilities.FIREFOX

# Tell the Python bindings to use Marionette.
# This will not be necessary in the future,
# when Selenium will auto-detect what remote end
# it is talking to.
caps["marionette"] = True
caps["binary"] = "/Applications/Firefox.app/Contents/MacOS/firefox-bin"

from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
browser = webdriver.Firefox(capabilities=caps)
webdriver.Firefox.get_capabilities()
browser.implicitly_wait(3)

browser.get("https://www.example.com/examplepage")

saved_exports_field = browser.find_element_by_id('exportlist')
saved_exports_field_select = Select(saved_exports_field)
</code></pre>

<p>That is where it goes wrong. The trace is as follows</p>

<pre><code>---------------------------------------------------------------------------
WebDriverException                        Traceback (most recent call last)
&lt;ipython-input-35-6e712759af43&gt; in &lt;module&gt;()
      1 saved_exports_field = browser.find_element_by_id('exportlist')
----&gt; 2 saved_exports_field_select = Select(saved_exports_field)
      3 #saved_exports_field_select.select_by_visible_text('test score export dan')

/Users/dan/anaconda/envs/lt/lib/python3.5/site-packages/selenium/webdriver/support/select.py in __init__(self, webelement)
     39                 webelement.tag_name)
     40         self._el = webelement
---&gt; 41         multi = self._el.get_attribute("multiple")
     42         self.is_multiple = multi and multi != "false"
     43 

/Users/dan/anaconda/envs/lt/lib/python3.5/site-packages/selenium/webdriver/remote/webelement.py in get_attribute(self, name)
    134             attributeValue = self.parent.execute_script(
    135                 "return (%s).apply(null, arguments);" % raw,
--&gt; 136                 self, name)
    137         else:
    138             resp = self._execute(Command.GET_ELEMENT_ATTRIBUTE, {'name': name})

/Users/dan/anaconda/envs/lt/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py in execute_script(self, script, *args)
    463         return self.execute(Command.EXECUTE_SCRIPT, {
    464             'script': script,
--&gt; 465             'args': converted_args})['value']
    466 
    467     def execute_async_script(self, script, *args):

/Users/dan/anaconda/envs/lt/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py in execute(self, driver_command, params)
    234         response = self.command_executor.execute(driver_command, params)
    235         if response:
--&gt; 236             self.error_handler.check_response(response)
    237             response['value'] = self._unwrap_value(
    238                 response.get('value', None))

/Users/dan/anaconda/envs/lt/lib/python3.5/site-packages/selenium/webdriver/remote/errorhandler.py in check_response(self, response)
    190         elif exception_class == UnexpectedAlertPresentException and 'alert' in value:
    191             raise exception_class(message, screen, stacktrace, value['alert'].get('text'))
--&gt; 192         raise exception_class(message, screen, stacktrace)
    193 
    194     def _value_or_default(self, obj, key, default):

WebDriverException: Message: SyntaxError: missing ) in parenthetical
</code></pre>

<p>Thanks</p>

<p>There's a bug in release 3.0.0-beta-3 which prevents the use of <code>get_attribute</code>. So you can either revert to 3.0.0-beta-2 or you can fix the bug by editing the file yourself:</p>

<p>In file 
<code>/Users/dan/anaconda/envs/lt/lib/python3.5/site-packages/selenium/webdriver/remote/webelement.py</code>, replace the line 133:</p>

<pre><code>raw = pkgutil.get_data(__package__, 'getAttribute.js')
</code></pre>

<p>by:</p>

<pre><code>raw = pkgutil.get_data(__package__, 'getAttribute.js').decode('utf8')
</code></pre>

python selenium firefox selenium-webdriver firefox-marionette