python3.0制表符_Python3.5.2,selenium 3.0.0b2,Firefox 48.0:使用缩进中的制表符和空格不一致...

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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值