Python selenium phantom js

时间:2017-06-24 18:24:43

标签: python selenium testing dropdown

Python Selenium和Phantom JS存在问题。 问题:将驱动程序设置为Phantom JS

<div class="ProfileTweet-action ProfileTweet-action--more js-more-ProfileTweet-actions">
  <div class="dropdown">
    <button class="ProfileTweet-actionButton u-textUserColorHover dropdown-toggle js-dropdown-toggle" type="button" aria-haspopup="true">
  
  </button>
    <div class="dropdown-menu is-autoCentered">
      <div class="js-first-tabstop" tabindex="0"></div>
      <div class="dropdown-caret">
        <div class="caret-outer"></div>
        <div class="caret-inner"></div>
      </div>
      <ul tabindex="-1" role="menu" aria-labelledby="menu-1" aria-hidden="false">
        <li class="js-actionDelete" role="presentation">
          <button type="button" class="dropdown-link" role="menuitem">Удалить  </button>
        </li>

      </ul>
      <div class="js-last-tabstop" tabindex="0"></div>
    </div>
  </div>

</div>

实际问题在于----点击此课程后

  ProfileTweet-action ProfileTweet-action--more js-more-ProfileTweet-actions

下面的代码

 driver.find_element_by_css_selector("div.IconContainer").click()

没有做到这一点,但当驱动程序设置为Firefox时,它按预期工作  。 有什么我想念的吗?感谢

修改1 为简单起见,我排除了所有元素,只留下了打开下拉列表的按钮 这是代码

 <button class="ProfileTweet-actionButton u-textUserColorHover dropdown-toggle js-dropdown-toggle" type="button" id="menu-0">   </button>

这里的问题是 PahntomJS 不是DOM本身因为正如我上面提到的那样,脚本与 firefox 驱动程序一样正常工作

0 个答案:

没有答案
相关问题