RFT-how to get the title of the webpage in RFT - rft

I am currently trying to automate a web application using RFT.The web application is written in Java.
My test case,the moment,I navigate to a particular page,I want to get the title of the webpage
example:- you go to www.google.com and then click on 'News'. The page title is "Google News".
I want to get this title.
Like in Selenium,I am aware that getTitle() used to give me the Title of the page
Please help!
Thanks!

getting the tile depends on what type of application it is( I mean if its Html/Win/.Net/Java etc) and what is the type of object you have in the object map for it. To get any information you are looking for you can use the TestObjectInspector in RFT. Using TestobjectInspector(and setting it to "Show Properties" ) you can check which property is the one that shows the title and then on that object you can call getProperty("propertyName");
For Java application (as you mentioned your application is based on) you might use .captionText or if you have htmlbrowser in the object map you can find the htmldocument (htmlbrowser's child) and then call getProperty(".title").

you can use yourDocumentObject().getProperty("title"). Use Recorder window to select and insert the document object.

Related

How to call chrome function from browser content page in xulrunner

I am converting code that originally ran as remote signed jar files in Firefox to use XULRunner instead. There are several reports that are implemented as web pages with an output option. Options include an HTML page or a report viewer that is written in XUL and Javascript.
When the user submits the form, and the report viewer is selected, then I need to open a chrome window. Obviously this cannot be done directly for security reasons. I want to provide a function or use some sort of message passing method to signal to the containing chrome what needs to happen.
Can this be done and if so how? Things I am considering:
1) Adding a function to the content window's window or document object
2) Some sort of message passing function
3) Some sort of customer event send/receive
4) A special URL form with a handler such as repviewer://repname/parameters
There is a quite elaborate article on this topic on MDN. The best way to achieve this without jeopardizing security is to send a generic event from your web page. The top XUL document should call addEventListener() with the fourth parameter set to true which will allow it to receive such untrusted events. Data can be passed through an attribute of the event target, the XUL document can then inspect that attribute.

Sitefinity 4.4 - Dynamically change page title and description at runtime

Does anyone know how to dynamically change the page title in Sitefinity from a regular user control?
Our scenario is simple. We have a real estate website with a search feature. On the search results page we have a control showing the search results, but we need to be able to change the Page title, description and keywords based on the search performed.
We posted on Telerik, but they gave vague answers and pointed us to incorrect objects or objects that didn't actually work.
?
Regards,
Jacques
The way I've usually done this in the past is by using an external widget template.
By mapping your widget template to an external file, you can use a full User Control (.ascx file) which means you can also run code behind.
From there it's just a matter of running something like
Page.Title = "whatever";
For more info on using an external template for Sitefinity Widgets, check out this post: http://www.sitefinity.com/blogs/joshmorales/posts/11-05-10/mapping_external_templates_for_sitefinity_4_widgets.aspx
Hope this is helpful!

How to pass control to a new window(not popup) in selenium?

My site has a link which navigate to another site. I have to check whether the link taking the user to correct website. The following is the code i've written to pass control
selenium.click("link=target window");
selenium.selectWindow("Title of target window");
assertTrue((selenium.isTextPresent("content in target window")));
selenium.close();
selenium.selectWindow("null");
But if i run this i'm getting error like "Could not find window with title ... "
There is information about how the selectWindow() function locates the window here. In particular,
If you're having trouble figuring out what is the name of a window
that you want to manipulate, look at the selenium log messages which
identify the names of windows created via window.open (and therefore
intercepted by selenium). You will see messages like the following for
each window as it is opened:
debug: window.open call intercepted;
window ID (which you can use with selectWindow()) is "myNewWindow"

Is there a way to find the browser window height and width in VB.Net without having using javascript?

I am needing to get the browser height and width of the browser window with vb. I can get these values by setting an ASP.Net hidden input control using javascript, after the page has loaded and a post back is done. I need to be able to get these values when the page initially loads so I can create an image based on those values.
I am still new at VB.Net, so any help would be great. Thanks!
Quick answer: No, you cannot.
BUT: You may have access to those values by looking at the request headers values.
Please note that the value may not always be there and that different browser may or may not sent those values with different keys.
The best way to have this value should be usign javascript or vbscript (ie CLIENT script). You may use ajax you create your image async way.
ASP.NET is a SERVER side programming language (like JSP or PHP) and has nothing to do with which browser access it...
Look at it this way, what is the screen size of Google Bot "browser" ? Or what if a access your site with telnet ?
So you should use client script to have acces to client properties.
Do not hesitate to comment if I am not clear or right.

how to read/parse dynamically generated web content?

I need to find a way to write a program (in any language) that will connect to a website and read dynamically generated data from the website.
Note that it's dynamically generated--it's not enough to get the source html, because the data I'm interested in is generated via javascript that references back-end code. So when i view the webpage source, I can't see the data. (For example, go to google, and do a search. Check the source code on the search results page. Very little of the data your browser is displaying is reflected in the source--most of it is dynamically generated. I need some way to access this data.)
Pick a language and environment that includes an HTML renderer (e.g. .NET and the WebBrowser control). Use the HTML renderer to get the URL and produce an HTML DOM in memory (making sure that scripting is enabled). Read the contents of the HTML DOM after the renderer has done its work.
Example (you'll need to do this inside a System.Windows.Form derived class):
WebBrowser browser = new WebBrowser();
browser.Navigate("http://www.google.com");
HtmlDocument document = browser.Document;
// extract what you want from the document
I used to have a Perl program to access Mapguide.com to get the drive direction from one location to another location. I parsed the returned page and save to database. If the source never change their format, it is OK. the problem is the source format often change, your parser also need change.
A simple thought: if we're talking about AJAX, you can rather look up the urls for the dynamic data. Then you can use the javascript on the page you're talking about to reformat this.
If you have Firefox/greasemonkey making a DOM dumper should be a simple matter.