Jump to content

Recommended Posts

Posted

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)

image.png.c1ee9fee103b9e9117a9c74465885c6b.pngimage.png.087fc65443e75a5d9d3e4e14830fe12a.png

 

Posted

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')

 

Posted

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!

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...