Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Selenium-Python中与CKEditor交互_Python_Selenium_Ckeditor_Wysiwyg - Fatal编程技术网

在Selenium-Python中与CKEditor交互

在Selenium-Python中与CKEditor交互,python,selenium,ckeditor,wysiwyg,Python,Selenium,Ckeditor,Wysiwyg,我目前正在通过一个我工作时使用的网站,实现电子邮件生成器的自动化。目前,我主要使用selenium,我非常困惑,因为我无法让selenium与页面上的ckeditor交互。到目前为止我已经试过了 切换到iframe,如中所述: 我还使用了几种xpath变体。。。 我还尝试了css选择器: Input_Frame = browser.find_element_by_css_selector("iframe[class='cke_wysiwyg_frame cke_reset']") Input_F

我目前正在通过一个我工作时使用的网站,实现电子邮件生成器的自动化。目前,我主要使用selenium,我非常困惑,因为我无法让selenium与页面上的ckeditor交互。到目前为止我已经试过了

切换到iframe,如中所述:

我还使用了几种xpath变体。。。 我还尝试了css选择器:

Input_Frame = browser.find_element_by_css_selector("iframe[class='cke_wysiwyg_frame cke_reset']")
Input_Frame = browser.find_element_by_css_selector("iframe[title='Rich Text Editor, CKeditorEmail']")
以及索引:

browser.switch_to_frame(0)
browser.switch_to_frame(1)
在上述所有情况下,selenium都无法找到元素/框架,因此我无法实际输入任何文本

我最终尝试了摆弄它,但它有点让我不知所措,我并没有真正得到很多结果。我确实发现输入CKEDITOR.instances['CKeditorEmail'].setData('helloworld!');在Firefox的控制台中,显示的文本发生了变化

如果有人能给我指点方向或提出解决方案,我将不胜感激。自动化的其余部分或多或少都已经完成了——这是我的第一个大项目之一,这一步花了我多长时间,让我感到震惊

另外,如果有人想在这个时候达到顶峰


提前谢谢

试试这个,它适合我,如果你需要更多信息,可以在这里找到文档。


您是否可以使用预期框架的基于文本的格式化HTML更新问题?
browser.switch_to_frame(0)
browser.switch_to_frame(1)
frame = driver.find_element(By.CLASS_NAME, 'cke_wysiwyg_frame')
driver.switch_to.frame(frame)
body = self.driver.find_element(By.TAG_NAME, 'body')
body.send_keys('tester')