克服阻止点击的div

时间:2018-06-05 14:23:46

标签: python selenium

您好我点击Instagram按钮时遇到了一些问题。 这是Html

<div class="_2dDPU" role="dialog">
  <div class="EfHg9">
  </div>
  <div class="zZYga" role="dialog">

  <div class="PdwC2 HYpXt" role="dialog">
    <div class="t48Bo fzjDT">Follower</div>
  <div class="j6cq2"><ul class="SrXZj YHaCL">
  <ul class="SrXZj YHaCL">
    <div class="_1xe_U">
    <li class="NroHT">
      <button class="_5f5mN       jIbKX KUBKM      yZn4P   ">Segui</button>
    <li class="NroHT">
      <button class="_5f5mN       jIbKX KUBKM      yZn4P   ">Segui</button>
    <li class="NroHT">
      <button class="_5f5mN       jIbKX KUBKM      yZn4P   ">Segui</button>
    <li class="NroHT">
      <button class="_5f5mN       jIbKX KUBKM      yZn4P   ">Segui</button>
    <li class="NroHT">
      <button class="_5f5mN       jIbKX KUBKM      yZn4P   ">Segui</button>
    <li class="NroHT">
      <button class="_5f5mN       jIbKX KUBKM      yZn4P   ">Segui</button>
  </ul>

我的代码就是这个

 try:
        #Search button

        segui = driver.find_element_by_css_selector(segui_css_selector)
        time.sleep(5)

    #except NoSuchElementException scroll the table

    except NoSuchElementException:
        driver.find_element_by_xpath (tabella_xpath).click ()
        elem = driver.find_element_by_css_selector (tabella_css_selector)
        elem.send_keys (Keys.ARROW_DOWN)
        elem.send_keys (Keys.ARROW_DOWN)

    #If it founds the button click it

    else:
        segui.click()
        time.sleep (5)
        a+=1
        print (a)
        time.sleep (5)

问题在于它为按钮提供了但是它给了我这个错误

selenium.common.exceptions.ElementClickInterceptedException: Message: Element <button class="_5f5mN       jIbKX KUBKM      yZn4P   "> is not clickable at point (1088.86669921875,155) because another element <div class="_2dDPU"> obscures it

代码有时可以点击按钮,有时候它不起作用,在某些页面上它一直在其他页面上工作,而不是为什么......

这是阻止点击的元素,它是一个包含iframe表的透明分区,我不知道如何传递它。

enter image description here

这是代码必须单击的按钮列表

enter image description here

0 个答案:

没有答案