I've been scraping a website using Selenium (Python Webdriver). When I try to have it click() an option, I get a permission denied error. Full stack trace:
Traceback (most recent call last): File "scrape.py", line 19, in <module> subjectOptions[1].click() File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/webelement.py", line 45, in click self._execute(Command.CLICK_ELEMENT) File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/webelement.py", line 194, in _execute return self._parent.execute(command, params) File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 153, in execute self.error_handler.check_response(response) File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 147, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: u"'Error: Permission denied for <http://localhost/scrape_test> to get property HTMLDocument.compatMode' when calling method: [wdIMouse::move]" Here is the code that causes the problem. I know for a fact that the option I'm trying to click exists (based on print):
from selenium import webdriver from selenium.common.exceptions import TimeoutException from selenium.webdriver.support.ui import WebDriverWait #available since 2.4.0 import time # Create a new instance of the FireFox driver driver = webdriver.Firefox() # go to the local version of the page for testing driver.get("http://localhost/scrape_test") # Find the select by ID, get its options selectElement = driver.find_element_by_id("CLASS_SRCH_WRK2_SUBJECT$65$") subjectOptions = selectElement.find_elements_by_tag_name("option") # Click the desired option subjectOptions[1].click() I'm using Firefox 8.0.1 on Mac OS X 10.7.2
<selenium.webdriver.remote.webelement.WebElement object at 0x10eb6fb90>. subjectOptions is a list of such WebElements