test_integration.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:pyramid_notebook 作者: websauna 项目源码 文件源码
def hacker_typing(browser, spinter_selection, code):
    """We need to break Splinter abstraction and fall back to raw Selenium here.

    Note: There is a bug of entering parenthesis due to IPython capturing keyboard input.

    http://stackoverflow.com/questions/22168651/how-to-enter-left-parentheses-into-a-text-box
    """
    elem = spinter_selection[0]._element
    driver = browser.driver

    # Activate IPython input mode
    ActionChains(driver).click(elem).send_keys(Keys.ENTER).perform()

    # Type in the code
    a = ActionChains(driver)
    a.send_keys(code)
    a.perform()
    time.sleep(1.0)

    # Execute the text we just typed
    a = ActionChains(driver)
    a.key_down(Keys.SHIFT).send_keys(Keys.ENTER).key_up(Keys.SHIFT)
    a.perform()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号