单击硒python不起作用

时间:2018-11-06 19:34:11

标签: python selenium webdriver click

我尝试使用id,css选择器,标签名称,链接名称,xpath等进行点击。但是不起作用。

这是HTML:

<a id="download" class="small-button smallred" data-url="//file-converter-online.com/download/" style="display: inline-block;">
                                        Start Converting!                                    </a>

我正在使用python 3.7.1,webdriver(chrome),硒模块。 我该怎么解决?

我的尝试失败:

browser.find_element_by_id("download").click()
browser.find_element_by_xpath('//*[@id="download"]').click()
browser.find_element_by_css_selector(".small-button.smallred").click()

错误

Traceback (most recent call last):
  File "G:\Mi unidad\Logs\fecha.py", line 22, in <module>
    browser.find_element_by_id("download").click()
  File "C:\Users\4209461\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium-3.14.1-py3.7.egg\selenium\webdriver\remote\webelement.py", line 80, in click
    self._execute(Command.CLICK_ELEMENT)
  File "C:\Users\4209461\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium-3.14.1-py3.7.egg\selenium\webdriver\remote\webelement.py", line 633, in _execute
    return self._parent.execute(command, params)
  File "C:\Users\4209461\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium-3.14.1-py3.7.egg\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "C:\Users\4209461\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium-3.14.1-py3.7.egg\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Element <a id="download" class="small-button smallred" data-url="//file-converter-online.com/download/" style="display: inline-block;">...</a> is not clickable at point (105, 539). Other element would receive the click: <li>...</li>
  (Session info: chrome=70.0.3538.77)
  (Driver info: chromedriver=2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a),platform=Windows NT 6.1.7601 SP1 x86_64)

我失败的尝试:

browser.find_element_by_id("download").click()
browser.find_element_by_xpath('//*[@id="download"]').click()
browser.find_element_by_css_selector(".small-button.smallred").click()

0 个答案:

没有答案