I’m trying to know if there is a text in current window, but the element is behind 2 iframes.
Initially I tried with storeXpathCount:
storeXpathCount | xpath=//p[contains(text(),‘Good morning all’)] | counter
and ${counter} = 0, so is not detected. Then I need to select 2 frames first like this:
selectFrame | relative=top
selectFrame | index=0
selectFrame|id=some_id
storeText | xpath=//p[contains(text(),'Good morning all')] | txtvar
executeScript | return ${txtvar}.includes(\"morning\"); | textfound
if | ${textfound} == true |
echo | "do something" |
else | |
echo | "do domething else"|
end | |
Is there a way to check if the text “morning” is present in that element in a single javascript code, in order to have get something like this?
executeScript | Some javascript code | textfound
if | ${textfound} == true |
echo | "do something" |
else | |
echo | "do domething else"|
end | |
This is in json format:
{
"Command": "selectFrame",
"Target": "relative=top",
"Value": "",
"Description": ""
},
{
"Command": "selectFrame",
"Target": "index=0",
"Value": "",
"Description": ""
},
{
"Command": "selectFrame",
"Target": "id=some_id",
"Value": "",
"Description": ""
},
{
"Command": "storeText",
"Target": "xpath=//p[contains(text(),'Good morning all')]",
"Value": "txtvar",
"Description": ""
},
{
"Command": "executeScript",
"Target": "return ${txtvar}.includes(\"morning\");",
"Value": "textfound",
"Description": ""
},
{
"Command": "if",
"Target": "${textfound} == true",
"Value": "",
"Description": ""
},
{
"Command": "echo",
"Target": "\"Do somenthing\"",
"Value": "",
"Description": ""
},
{
"Command": "else",
"Target": "",
"Value": "",
"Description": ""
},
{
"Command": "echo",
"Target": "\"Do something else\"",
"Value": "",
"Description": ""
},
{
"Command": "end",
"Target": "",
"Value": "",
"Description": ""
}
Thanks for any help.