Forum Discussion

romanmfs's avatar
romanmfs
Frequent Contributor
7 years ago

Check webpage for containing specific text

Hi all!

 

I have a small experience working with scrips.

 

Need help getting this to work:

 

 

function Test()
{

var url = "https://www.consolidatedcredit.org";
Browsers.Item(btIExplorer).Run(url);
var browser = Sys.Browser("*");

var body = browser.Page("*").contentDocument.body;
var str = "debt";


// Checks the result
if (obj.Exists)
Log.Message("Object containing text '" + str + "' is found", obj.FullName);
else
Log.Warning("Object containing text '" + str + "' was not found.");


}

 

 

 

What I try to achieve: to search the site (consolidatedcredit.org) for any text that includes a letter "debt".

Can you guys help me with what I am missing? The current test does not even open up the URL specified. 

 

 

Thanks,

Roman

1 Reply

  • baxatob's avatar
    baxatob
    Community Hero

    Hi,

     

    First of all please provide whats error did you receive after running the script above?

     

    I ran your script, it normally opens the IE browser and navigating to the URL.

     

    However you have not defined the obj variable and that is the problem.