This discussion is archived
1 Reply Latest reply: Nov 6, 2013 6:11 AM by user13153726 RSS

OATS:How to retrieve the URL string after launching the browser?

user13735168 Newbie
Currently Being Moderated

Hi,

I am automating Siebel Test cases using OATS.

 

This is the requirement:

1. I launch the url "http://slc05ewj/callcenter_enu/start.swe?SWECmd=AutoOn" using browser.launch

2. After the url launches, it appends certain parameters to URL like the following

"http://slc05ewj/callcenter_enu/start.swe?SWECmd=AutoOn&_sn=M-kbZ9yXVnoXHckIhNwugnmguC-113KdKYfTW5vuBCzTjnWl5a9kHT.z8Wy0VHw0-TyZiTEyTu1ib5InPviFz7h-xlKvIK26p-9tT7uJPRKMoUpe2MFzqQfr1q-APXcus3mXI5.dyWfXpN7ogONNTG4oXnpAm0vSH0scqV7-r8clVwjXN8JHukAMvd2b-Zaa&SRN=&SWEHo=slc05ewj&SWETS=1383635023"

 

I want to retrieve this entire string to extract a sub string from this.

 

How can i get the url string in the browser?

 

Thanks,

Karthi

  • 1. Re: OATS:How to retrieve the URL string after launching the browser?
    user13153726 Newbie
    Currently Being Moderated

    Hi Karthi,

     

    From the browser you can get this by executing "document.location.href" from developer tools console (from the application browser press F12 and select console)

     

    Coming to reading the url from the OATS can be accomplished as below:

     

    Step 1:  Import the dom4j as below:

    import org.dom4j.dom.DOMDocument;

     

    Step 2:  Then use getRecordedURL() as shown below:

    String domurl = web.document("/web:window[@index='0' or @title='OPERA 9 Application']").getRecordedURL();

    System.out.println("Document URL: "+domurl);

     

    This should solve your problem, let me know if it doesn't

     

    Thanks,

    Sri Patibandla

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points