QA亮子的记事本

记录开发测试中碰到的问题和解决办法

导航

如何用Selenium 向CodeMirror 编辑器输入

用Selenium 自动填写Jenkins上面一个文本输入框,通过css定位很容易,但是输入文字的时候会报错

ElementNotVisibleException: Message: Element is not currently visible and so may not be interacted with

 

后来发现这个textarea 用CodeMirror了, google 结果如下

css_panel = driver.find_element_by_id("panel_css")

code_mirror_element = css_panel.find_element_by_css_selector(".CodeMirror")
driver.execute_script("arguments[0].CodeMirror.setValue(arguments[1]);",
                      code_mirror_element, 
                      "test")

http://initcode.info/elementnotvisibleexception_message_element_is_not_currently_visiblehellip_selenium_python

http://stackoverflow.com/questions/21844574/programmatically-edit-codemirror-contents-without-access-to-object

posted on 2016-05-19 18:21  sdet_liang  阅读(782)  评论(0编辑  收藏  举报