Traceback (most recent call last):
File "C:/Users/****/PycharmProjects/********/load_all_params.py", line 2, in
from selenium import webdriver
File "C:\Users\*****\AppData\Local\Programs\Python\Python35-32\lib\site- packages\selenium-3.0.0b2-py3.5.egg\selenium\webdriver\__init__.py", line 25, in
from .safari.webdriver import WebDriver as Safari # noqa
File "C:\Users\*****\AppData\Local\Programs\Python\Python35-32\lib\site- packages\selenium-3.0.0b2-py3.5.egg\selenium\webdriver\safari\webdriver.py", line 49
executable_path = os.environ.get("SELENIUM_SERVER_JAR")
^
TabError: inconsistent use of tabs and spaces in indentation
Process finished with exit code 1
My question is this an error with my code or is this error caused by update to selenium-3.0.0b2? The weird thing is that I am using Firefox(48.0) and here the Safari is listed. What is going on?!
The script I wrote has no spaces or tabs - its just a list of commands.
My code sample:
from selenium import webdriver
driver = webdriver.Firefox()
driver.get("http://192.168.99.100:8080/***/***")
driver.implicitly_wait(10)
element = driver.find_element_by_id("lv-username")
and so on...
解决方案
I had the same error and what worked for me was going to the path of the init.py in your case it would be
"C:\Users*****\AppData\Local\Programs\Python\Python35-32\lib\site- packages\selenium-3.0.0b2-py3.5.egg\selenium\webdriver__init__.py"
Then just comment out the line
from .safari.webdriver import WebDriver as Safari # noqa
That is the one for the safari browser. Since that is not the one you want to use anyways.