Paulliev Posted March 4, 2021 Share Posted March 4, 2021 Hello, I'm working on a Chrome automatization and I want to pass a description in my description box. The problem is that the description box is 2 iframes deep and it is a WYIWYG editor. So I need to get the text inside a <p> tag. See the code and screenshots below. _ChromeClickDescription($sSession, 'ahoy-button-base ahoy-button-icon ahoy-button-medium icon-only icon-24x24-edit-outline') Sleep(5000) $sIframe = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//iframe[@id='TL_iframe']") _WD_FrameEnter($sSession, $sIframe) $sIframe2 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//html/body/form/div/div/div/div[@id='cke_1_contents']/iframe[@class='cke_wysiwyg_frame cke_reset']") _WD_FrameEnter($sSession, $sIframe2) $sText = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "/html/body/p") _WD_ElementAction($sSession, $sText, 'click') _WD_ElementAction($sSession, $sText,'value', 'TEST') Sleep(5000) Link to comment Share on other sites More sharing options...
Danp2 Posted March 4, 2021 Share Posted March 4, 2021 That element type doesn't have a value attribute, so you won't be able to set its contents with _WD_ElementAction. You will probably need to use _WD_ExecuteScript to set the element's innerText attribute. Alternatively, you may be able to use an API provided by the editor component (guessing CKEditor) to update the control. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Danp2 Posted March 4, 2021 Share Posted March 4, 2021 Got an idea from reading about this online. Instead of -- $sText = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "/html/body/p") _WD_ElementAction($sSession, $sText, 'click') _WD_ElementAction($sSession, $sText,'value', 'TEST') Try -- $sText = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "/html/body") _WD_ElementAction($sSession, $sText,'value', 'TEST') Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Paulliev Posted March 5, 2021 Author Share Posted March 5, 2021 Goodmorning @Danp2, First of all, thanks for your answers. I thought I already tried it with html/body. But it seems to work now! This is what I got right now: ; Beschrijving _ChromeClickDescription($sSession, 'ahoy-button-base ahoy-button-icon ahoy-button-medium icon-only icon-24x24-edit-outline') $sIframe = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//iframe[@id='TL_iframe']") _WD_FrameEnter($sSession, $sIframe) Sleep(1000) $sIframe2 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//html/body/form/div/div/div/div[@id='cke_1_contents']/iframe[@class='cke_wysiwyg_frame cke_reset']") _WD_FrameEnter($sSession, $sIframe2) $sText = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "/html/body") _WD_ElementAction($sSession, $sText,'value', $Beschrijving) _WD_FrameLeave($sSession) _ChromeClickDescriptionSaveButton($sSession, 'thebutton') Sleep(4000) Thank you for your help! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now