How do I send keys to 3 TinyMCE
fields on the same screen, and the Iframe ID
is dynamic using selenium webdriver c#
?
The code below works if the id
of the frame was not dynamic:
Driver.SwitchTo().Frame("ea05aa0a-668b-4a08-9770-221262e77b29_ifr");
Driver.FindElement(By.Id("tinymce")).SendKeys("hello 1");
Driver.SwitchTo().DefaultContent();
Driver.SwitchTo().Frame("c45c67ae-d33b-4ec3-be2e-12a6d40b14ab_ifr");
Driver.FindElement(By.Id("tinymce")).SendKeys("hello 2");
Driver.SwitchTo().DefaultContent();
Driver.SwitchTo().Frame("bbfce656-ea5e-4f01-b409-437d0c60e187_ifr");
Driver.FindElement(By.Id("tinymce")).SendKeys("hello 3");
Driver.SwitchTo().DefaultContent();
Code field TinyMCE
1:
<div id="mce_44" class="mce-edit-area mce-container mce-panel mce-stack-layout-item" tabindex="-1" hidefocus="1" style="border-width: 1px 0px 0px;">
<iframe id="ea05aa0a-668b-4a08-9770-221262e77b29_ifr" frameborder="0" src="javascript:""" allowtransparency="true" title="Área de texto formatado. Pressione ALT-F9 para exibir o menu…a exibir a barra de ferramentas ou ALT-0 para exibir a ajuda" style="width: 100%; height: 100px; display: block;">
#document
<!DOCTYPE html>
<html webdriver="true">
<head></head>
<body id="tinymce" class="mce-content-body " contenteditable="true" onload="window.parent.tinymce.get('ea05aa0a-668b-4a08-9770-221262e77b29').fire('load');" spellcheck="false"></body>
Thanks!