2

I have downloaded the win-64 version and now trying to add Selenium package into my project in Spyder. However, I kept getting the same error when I tried running my test script.

This is the link where I download the package from: https://anaconda.org/conda-forge/selenium/files

import unittest
from selenium import webdriver

class SampleTest(unittest.TestCase):
    def setUp(self):
        self.driver = webdriver.Ie()
        driver = self.driver
        driver.get("www.google.com")

    def tearDown(self):
        self.driver.quit()

if __name__ == "__main__":
    unittest.main()

The error message I got was: ImportError: cannot import name 'webdriver'.

I am suspecting I have placed the selenium package in the wrong directory? I have placed in both the project directory and C:\~\Anaconda3\Lib.

Note: I have placed the Internet Explorer web driver in the project directory too.

If you're wondering why I did not use command lines to install packages is because my development machine is only connected to intranet which means it has no internet access. I have to use a thumbdrive to transfer the package I have downloaded using another machine.

Francis
  • 21
  • 2
  • 4

0 Answers0