I pulled this Python code from Selenium IDE export option and I replaced self.driver = webdriver.Firefox()
with HtmlUnitDriver() but it doesn't work since I have an error :
AttributeError: 'module' object has no attribute 'HtmlUnitDriver'
The code is :
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException
import unittest, time, re
class Scrape(unittest.TestCase):
def setUp(self):
self.driver = webdriver.HtmlUnitDriver()
self.driver.setJavascriptEnabled(true)
self.driver.implicitly_wait(30)
self.base_url = "http://www.google.com/"
self.verificationErrors = []
self.accept_next_alert = True
def test_scrape(self):
driver = self.driver
....
Could you indicate me what I'm doing wrong ? I would like to use HtmlUnit instead of firefox to see if I can achieve my goal faster with less ressources. I would need to have Javascript activated if possible. If it is possible could you also tell me where I'm supposed to get those information from the documentation since I failed to find it ?