A very good article to read about Exploratory Testing.
http://www.satisfice.com/articles/what_is_et.shtml
Friday, 14 August 2009
My Answer(s) posted on Code Project web site Part-2
Question : How to maximize window
Hi I'm using WatiN testing tool, I have problem in maximinzing the windowi used the following codeie.ShowWindow(NativeMethod.ShowWindowStyle.Maximize)but i'm getting error: "NativeMethod does not exist in the current context "and the window is not maximized.plz help me with this..
thanking you
Jawed: Hi Friend , please use the below code to maximizg the IE window.
ie.ShowWindow(NativeMethods.WindowShowStyle.Maximize);
Thanks.
Question: How to handle javascript popup's
Hi I've scenario where i need to create users and upon successfully creating a user i get a popup with Successfully created msg and contains a "OK" button i need to click on the popup to continue further how to handle these kind of popups and also how to downlaod a file and save it. please suggest some solution.
Jawed: For Succesfully created msg popup you can use below code(if it is ALERT)
//Add this namespace for dialogHandlers
using WatiN.Core.DialogHandlers;
AlertDialogHandler alertDialogHandler = new AlertDialogHandler();
ie.DialogWatcher.Add(alertDialogHandler );
alertDialogHandler.WaitUntilExists();
alertDialogHandler.OKButton.Click();
ie.WaitForComplete();
ie.DialogWatcher.RemoveAll(alertDialogHandler);
Hope it would be usefull for you.Thanks!!
Question: Use WatiN to fill form fields in a running IE instance
Hi,Is it possible to use WatiN to interact with a running instance of IE. I'm looking for a toolset that makes it easy to fill fields (such as textboxes, comboboxes, checkboxes) in a webpage (that's part of a portal solution).Does WatiN also allow to select submenu-items on a page ? Thanx Filip!
Jawed: Hi , WATiN can perform an action similar to a tester or user is performing on any application.the action perform by WATiN tool is called as Automation yeah WATIN can allow you to select submenu-items on an application page.after writing few lines of code in WATIN using C# it can fill the required input fields like(textboxes,select combo- boxes,checked/unchecked checkbox,radio button,click on link etc etc).
please refer the below link for more information
http://watin.sourceforge.net/gettingstarted.html
Happy Automation.
Question: Re:Use WatiN to fill form fields in a running IE instance
Thanks Jawed !
But can I also hook WatiN into a running instance of IE, or not ?
Or in other words, what does the following line of code do when an other IE window is already opened?
// Open Internet Explorer window and
// goto the portal webapp
IE ie = new IE(http://www.e-notariaat.be);
Does it add another TAB or does it open a separate IE window (with seperate logon credentials) ?
In Delphi, I could do automation on a running OR new instance of e.g.
Word : try MSWord := GetActiveOleObject('Word.Application');
except MSWord := CreateOleObject('Word.Application');
end;
The problem I see (although I'm not sure) is that the website I wish to target, is a portal that requires a SmartCard-based login (+manual pin-code), and as most users have already logged in to this portal in their running IE session, I wish to hook in there too ...I haven't tried any of this, but I try to foresee how and if this would work in a typical use case of my customers...
Jawed: Thanks Filip!!Please find below my answers related to your queries.
Filip: But can I also hook WatiN into a running instance of IE, or not ?
jawed: yes you can!!!just a simple Watin code can hook the running instance of IE
IE ie = IE.AttachToIE(Find.ByUrl(url));
the above line of would take the control of already running instance of IE searching by URL.
Filip: what does the following line of code do when an other IE window is already opened?
// Open Internet Explorer window and
// goto the portal webapp
IE ie = new IE(http://www.e-notariaat.be/);
Does it add another TAB or does it open a separate IE window (with seperate logon credentials) ?
Jawed:The above line of code will open a new instance of IE browser.
Filip: The problem I see (although I'm not sure) is that the website I wish to target, is a portal thatrequires a SmartCard-based login (+manual pin-code), and as most users have already logged in tothis portal in their running IE session, I wish to hook in there too ...
Jawed: For this approach you can apply method like : Find the already running instance of IE by URL/Value/title etc and take the control of that running IE instance.for that you can use below line of code
IE ie = IE.AttachToIE(Find.ByUrl("") Find.ByClass("") Find.ById("") Find.ByName("") Find.ByTitle("") Find.ByValue(""));
Please let me know for any question/concern
Continue..
Filip: Hi Jawed,
Thanks for the answers ! Now, I am convinced that WatiN will let me do the stuff I would like to accomplish. Right now, I am enjoying a weekend in the Ardennes (in the south of Belgium) with my wife and kids, but I will give WatiN a good spin real soon.
Thanks again.
Filip
Hi I'm using WatiN testing tool, I have problem in maximinzing the windowi used the following codeie.ShowWindow(NativeMethod.ShowWindowStyle.Maximize)but i'm getting error: "NativeMethod does not exist in the current context "and the window is not maximized.plz help me with this..
thanking you
Jawed: Hi Friend , please use the below code to maximizg the IE window.
ie.ShowWindow(NativeMethods.WindowShowStyle.Maximize);
Thanks.
Question: How to handle javascript popup's
Hi I've scenario where i need to create users and upon successfully creating a user i get a popup with Successfully created msg and contains a "OK" button i need to click on the popup to continue further how to handle these kind of popups and also how to downlaod a file and save it. please suggest some solution.
Jawed: For Succesfully created msg popup you can use below code(if it is ALERT)
//Add this namespace for dialogHandlers
using WatiN.Core.DialogHandlers;
AlertDialogHandler alertDialogHandler = new AlertDialogHandler();
ie.DialogWatcher.Add(alertDialogHandler );
alertDialogHandler.WaitUntilExists();
alertDialogHandler.OKButton.Click();
ie.WaitForComplete();
ie.DialogWatcher.RemoveAll(alertDialogHandler);
Hope it would be usefull for you.Thanks!!
Question: Use WatiN to fill form fields in a running IE instance
Hi,Is it possible to use WatiN to interact with a running instance of IE. I'm looking for a toolset that makes it easy to fill fields (such as textboxes, comboboxes, checkboxes) in a webpage (that's part of a portal solution).Does WatiN also allow to select submenu-items on a page ? Thanx Filip!
Jawed: Hi , WATiN can perform an action similar to a tester or user is performing on any application.the action perform by WATiN tool is called as Automation yeah WATIN can allow you to select submenu-items on an application page.after writing few lines of code in WATIN using C# it can fill the required input fields like(textboxes,select combo- boxes,checked/unchecked checkbox,radio button,click on link etc etc).
please refer the below link for more information
http://watin.sourceforge.net/gettingstarted.html
Happy Automation.
Question: Re:Use WatiN to fill form fields in a running IE instance
Thanks Jawed !
But can I also hook WatiN into a running instance of IE, or not ?
Or in other words, what does the following line of code do when an other IE window is already opened?
// Open Internet Explorer window and
// goto the portal webapp
IE ie = new IE(http://www.e-notariaat.be);
Does it add another TAB or does it open a separate IE window (with seperate logon credentials) ?
In Delphi, I could do automation on a running OR new instance of e.g.
Word : try MSWord := GetActiveOleObject('Word.Application');
except MSWord := CreateOleObject('Word.Application');
end;
The problem I see (although I'm not sure) is that the website I wish to target, is a portal that requires a SmartCard-based login (+manual pin-code), and as most users have already logged in to this portal in their running IE session, I wish to hook in there too ...I haven't tried any of this, but I try to foresee how and if this would work in a typical use case of my customers...
Jawed: Thanks Filip!!Please find below my answers related to your queries.
Filip: But can I also hook WatiN into a running instance of IE, or not ?
jawed: yes you can!!!just a simple Watin code can hook the running instance of IE
IE ie = IE.AttachToIE(Find.ByUrl(url));
the above line of would take the control of already running instance of IE searching by URL.
Filip: what does the following line of code do when an other IE window is already opened?
// Open Internet Explorer window and
// goto the portal webapp
IE ie = new IE(http://www.e-notariaat.be/);
Does it add another TAB or does it open a separate IE window (with seperate logon credentials) ?
Jawed:The above line of code will open a new instance of IE browser.
Filip: The problem I see (although I'm not sure) is that the website I wish to target, is a portal thatrequires a SmartCard-based login (+manual pin-code), and as most users have already logged in tothis portal in their running IE session, I wish to hook in there too ...
Jawed: For this approach you can apply method like : Find the already running instance of IE by URL/Value/title etc and take the control of that running IE instance.for that you can use below line of code
IE ie = IE.AttachToIE(Find.ByUrl("") Find.ByClass("") Find.ById("") Find.ByName("") Find.ByTitle("") Find.ByValue(""));
Please let me know for any question/concern
Continue..
Filip: Hi Jawed,
Thanks for the answers ! Now, I am convinced that WatiN will let me do the stuff I would like to accomplish. Right now, I am enjoying a weekend in the Ardennes (in the south of Belgium) with my wife and kids, but I will give WatiN a good spin real soon.
Thanks again.
Filip
Thursday, 13 August 2009
My Answer(s) posted on Code Project web site Part-1
In this Blog i would like to share my Answers which i have posted on Code project.
reference: http://www.codeproject.com/script/Forums/Messages.aspx?fmid=4764307
Question: Can WatiN accept inputs from an Excel sheet
Can WatiN accept inputs form an excel sheet. this functionality was there in watir.
Is this available in WatiN.
Jawed: yes it is.for that you need to write simple C# code to read from excel sheet.see below
some example from my side.
public class CommonClassAutomation
{
static string connectionString
= "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=
D:/test.xls;Extended Properties=Excel 8.0;";
public static string inputText= string.Empty;
public void TC_googletest()
{
reference: http://www.codeproject.com/script/Forums/Messages.aspx?fmid=4764307
Question: Can WatiN accept inputs from an Excel sheet
Can WatiN accept inputs form an excel sheet. this functionality was there in watir.
Is this available in WatiN.
Jawed: yes it is.for that you need to write simple C# code to read from excel sheet.see below
some example from my side.
public class CommonClassAutomation
{
static string connectionString
= "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=
D:/test.xls;Extended Properties=Excel 8.0;";
public static string inputText= string.Empty;
public void TC_googletest()
{
//before calling instance of browser read input from excel sheet.
readExcelsheet();
//Open instance of IE browser.
IE ie=new IE();
//Open Google.com in browser
ie.goto("www.google.com");
/*Provide input text in to google search box. which you have already having from
excel sheet.*/
ie.TextField(Find.ByName("q")).TypeText(inputText);
//Click on Search button.
ie.Button(Find.ByName("btnG")).Click();
}
//Method To read data from Excel sheet
public void readExcelsheet()
{
DbProviderFactory factory = DbProviderFactories.GetFactory
("System.Data.OleDb");
int inputCount=0;
using (DbConnection connection = factory.CreateConnection())
{
connection.ConnectionString = connectionString;
using (DbCommand command = connection.CreateCommand())
{
command.CommandText = "SELECT * FROM ["+ sheetName+"$]";
try
{
connection.Open();
using (DbDataReader dr = command.ExecuteReader())
{
if (dr.Read())
{
inputText= dr[1].ToString();
}
}
}
catch(Exception ex)
{
//To Do
}
}
}
}
}
Hope, it would be useful for you.
happy automation
Thanks,
Md.Jawed
Hi I'm working on WatiN tool. I've scenario where i need to check a checkbox and click on ok button in the popup window. i've used AttachtoIE method and used URL attribute to attach to the popup window. Now the problem is URL contains the ID value, which changes each time the popup appears.. so how to handle this or is there any other method other than AttachtoIE.
please give some suggestion thanking you.
Other Member: Yes I got it right, I ignored the query string part in the URL which used to change everytime.
for example,http://192.168.25.10:221/admin/UploadContent.aspx?opener=CustomContent_Add.aspxIn the above URL the second line is the query string which will be present after the question mark in the first line.so I used only the first line neglecting the second like this
string Url= http://192.168.25.10:221/admin/UploadContent.aspx;
IE popup = IE.AttachToIE(Find.ByUrl(Url, true);
this worked for me, hope this will help you
Jawed: Hi,@ninay_fz: nice reply
Just I want to add few points over here to make your piece of code to work with dynamic changing URL.In this situation is good practice to use Regular expression.
Add this name space to your code file.
using System.Text.RegularExpressions;
Use below code to generalize while accessing URL.
string Url= "http://192.168.25.10:221/admin/UploadContent.aspx";(or whatever string you want to put!!)
Regex reg = new Regex(Url);
IE popup = IE.AttachToIE(Find.ByUrl(reg , true));
Hope it would solve your problem.
Thanks,
Continue..............
Monday, 3 August 2009
Automatic Birthday scrap to your Orkut friends
This application would almost eliminate the human or user interaction to Orkut web site while sending Birthday Scarp to your Orkut friends.
Just copy this piece(wait for next blog for code) of code to your local folder. And click on .exe.
Not feeling to click on .exe :) then,
-> Go to control panel and add this application to Scheduled Tasks to run some predefined time.
And the predefined time this application would automatic run and will do the below mention steps. Even being in invisible mode :)
Not feeling to click on .exe :) then,
-> Go to control panel and add this application to Scheduled Tasks to run some predefined time.
And the predefined time this application would automatic run and will do the below mention steps. Even being in invisible mode :)
- The flow chart of this application is as below:-
1. Open Internet explorer (optional).
2. Go to Orkut website.
3. Login with predefined credential.
4. On successful login check that any friends birthday fall today.
5. If yes. Click on leave scarp and leave a predefined birthday wishes to selected friend’s scrap book.
6. Come back to home page.
7. Check for the next friend birthday if his/her birthday fall today repeat steps 5 to 6.
8. After above steps click on logout link.
9. Logout from Orkut and close the browser.
I have developed this console application using C#, .net2.0.
And for interface with Orkut I used WATIN tool/framework 2.0.
And for interface with Orkut I used WATIN tool/framework 2.0.
Note: best part of this aaplication is that i m not asking your Orkut's details at all.cuz this code would be with you so,whenever you want you can stop it or run it :)
For this blog I have attached only video.
In next blog, I would like to publish the code with .exe and about the code description. Thanks!!!
For this blog I have attached only video.
In next blog, I would like to publish the code with .exe and about the code description. Thanks!!!
My learning from this blog -: WATiN is not for Automation only. It can be used as API Interface .
Happy Orkuting :)
Thanks,
Md.Jawed
Monday, 27 July 2009
Run WATiN code thorugh web application
To run your WATiN Automation code/Script from web application or by using web application
Jus add this Header tag in .aspx file
< AspCompat="true" >
Example: - suppose that you have code file as MyWatinCode.aspx and MyWatinCode.aspx.cs.
Now go to MyWatinCode.aspx file and replace the top most Header Tag
<@ Page Language="C#" AutoEventWireup="true" CodeBehind=" MyWatinCode.aspx.cs" Inherits="AutomationTesting._ MyWatinCode" ValidateRequest="false">
By
<@ Page Language="C#" AutoEventWireup="true" CodeBehind=" MyWatinCode.aspx.cs" Inherits="AutomationTesting._ MyWatinCode" AspCompat="true" ValidateRequest="false" >
And run your Automation code in web Application .if still you are facing any issues please reply me.
Correction/Comments are always welcome :)
Happy Automation.....
Thanks,
Md.Jawed
Jus add this Header tag in .aspx file
< AspCompat="true" >
Example: - suppose that you have code file as MyWatinCode.aspx and MyWatinCode.aspx.cs.
Now go to MyWatinCode.aspx file and replace the top most Header Tag
<@ Page Language="C#" AutoEventWireup="true" CodeBehind=" MyWatinCode.aspx.cs" Inherits="AutomationTesting._ MyWatinCode" ValidateRequest="false">
By
<@ Page Language="C#" AutoEventWireup="true" CodeBehind=" MyWatinCode.aspx.cs" Inherits="AutomationTesting._ MyWatinCode" AspCompat="true" ValidateRequest="false" >
And run your Automation code in web Application .if still you are facing any issues please reply me.
Correction/Comments are always welcome :)
Happy Automation.....
Thanks,
Md.Jawed
Subscribe to:
Comments (Atom)