Tuesday, December 20, 2011

Selenium ide for internet explorer

Try http://code.google.com/p/fire-ie-selenium/downloads
This is not an IDE , a simple utility to get the locators ( ID,Name,Xpath,TagName).

Monday, December 19, 2011

Selenium Click and ClickAt

Click - to click on a Locator
ClickAt - to click on a Locator w.r.t coordinates

Basically ClickAt can be used as an alternate to Click for rich ui frameworks like DOJO,Wickets etc.

Tuesday, November 15, 2011

Selenium - Autosuggest edit field

keyPressNative method will be used to handle autosuggestion.
keyPressNative method -Simulates a user pressing and releasing a key by sending a native operating system keystroke. This function uses the java.awt.Robot class to send a keystroke; this more accurately simulates typing a key on the keyboard. It does not honor settings from the shiftKeyDown, controlKeyDown, altKeyDown and metaKeyDown commands, and does not target any particular HTML element. To send a keystroke to a particular element, focus on the element first before running this command.

public void selectAutosuggest(String webElementLocator,String inputValue){
char[] stringArray = inputValue.toUpperCase().toCharArray();
selenium.click(webElementLocator);
for(int i=0;i &lt stringArray.length ; i + +)
selenium.keyPress(webElementLocator,""+(int)stringArray[i]);
//Press downarrow and click EnterKey
selenium.keyPressNative(String.valueOf(KeyEvent.VK_DOWN));
selenium.keyPressNative(String.valueOf(KeyEvent.VK_ENTER));
Thread.sleep(1000);

}

Sunday, November 13, 2011

Selenium - XPATH - Location Of text...


If we want to click on some text which we dont know the Id,Name
we can use selenium.click("xpath=//*[text()=\"Search\"]")
To be more specific we can use
selenium.click("xpath=//*[@id='ParentDivId']//*[text()='Search']");



Wednesday, November 2, 2011

WebDriver - Listbox and few other details

In latest WebDriver , we have to use sendKeys to select a value from the listbox.
RenderedWebElement class has been depreceated.

Normal Driver instance can be as follows:
  firefox:
            FirefoxProfile firefoxProfile = new FirefoxProfile();
            firefoxProfile.setAcceptUntrustedCertificates(true);
            localDriver = new FirefoxDriver(firefoxProfile);
            localDriver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
            driver = localDriver;
         
 iexplore:
            DesiredCapabilities ieCapabilities = DesiredCapabilities.internetExplorer();
ieCapabilities.setCapability(
     InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,
                            true);
            ieCapabilities
                    .setCapability(CapabilityType.HAS_NATIVE_EVENTS, true);
            ieCapabilities.setCapability(CapabilityType.TAKES_SCREENSHOT, true);
            ieCapabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
            ieCapabilities.setCapability(CapabilityType.SUPPORTS_JAVASCRIPT,
                    true);
            localDriver = new InternetExplorerDriver(ieCapabilities);
           driver = localDriver;





Thursday, October 20, 2011

WebDriver waitForElement - waits for an element until given number of secs

public void waitForElement(final By by, long timeout) throws Exception {

(new WebDriverWait(DriverFactory.getDriver(), timeout))
.until(new ExpectedCondition() {
public Boolean apply(WebDriver d) {
return isElementPresent(by);
}
});
}

The above code can be used to wait for an element until it is displayed in webpage.
On new page loads we can use this command to wait before performing a new action by waitForElement which is a mandatory element to be displayed on page/section/frame refresh completes.

Thursday, August 18, 2011

Selenium Window target = "_blank" issue

For example if you have a link like



Upon click mylink , the url loads into a new window ,  to do some operations in newly opened window it is painful to identify the windowName ..etc

And the solution for that is
selenium.open("/test.html");
selenium.getEval("this.page().findElement(\"link=mylink with target _blank\").target='maddys_window'");
selenium..getEval("selenium.browserbot.getCurrentWindow().open('', 'maddys_window')");
selenium.click("link=mylink with target _blank");
Thread.sleep(2000);
selenium.selectWindow("maddys_window");
selenium.windowFocus();
......
......
selenium.close(); //to close maddys_window
selenium.selectWindow("null");  //to get focus to main window
....
...

Wednesday, August 3, 2011

Qutoes

1. Sun glow for a day, candle for an hour,Matchstick for a minute,Bt a gud day can glow with a SMILE. So start ur day with a SMILE. Have a nice day.

2.Every relationship is like a Cardiogram.. it always has an up and down graph. If its steady , it ends. So accept the ups and down in the life.

3.People say never expect anything from anyone. But the truth is when we really love someone, we naturally expect a little CARE and LOVE from them.

4.Some reasons make relationship precious, but precious relationships r made with No Reasons.. Keep those relations alive forever 4 the life time.

5.If you believe you can do something, then you can acquire the ability to do it even if you didnt have it in the beginning. so first we need TRUST.

6."Communication is the lifeline of any relationship." when you stop communicating, u start loosing ur valuable relationships, so be in touch..!

7.We should not judge a mans merit by his good qualities but by the way how he can use them. we r made richer and beautiful by the reflection of our thought and actions.

8.When you are in the right way u can afford to keep your temper, and when you are in the wrong way you can not afford to lose it.

9. Smile is the best credit card. bcoz it is Accepted worldwide, Auto reload, Unlimited Usage, No Payment, at all. Makes every one Happy.

10.Simple tips 2 play safe in the game of Life (a). Dont PROMISE when u r happy (b). Dont reply when ur ANGRY (c).Dont decide when ur r sad.

11. "Only a few people can feel the rain , others just get wet..!!." , "Only few people can feel the DIVINITY and VIBRATIONS, other just CASUAL"..!! :)

12.Everyday starts with some expectations. But Ends with some experience. That's Life.

13. Clock make sound as Tik Tik but listen carefully its not Tik Tik its real sound is Quick Quick , Because time is precious and never come again.

14.Victory is not the property of brilliants. It is the crown for those who bow themselves in front of hard work and confidence.

15.Best age is Encourage. Best mile is Smile, Best stand is Understand and Best End is Friend , Best day is today. Have every moment of everyday with NONSTOP SMILE.

16.When success is waiting for you, difficulties are blocking the path. Take the weapon of confidence and reach your success every day in your life.

17. The dangerous mistake in the life is the 1st LIE. It leads 2 many lies in order to manage it. ur not able 2 avoid it, even if u dont like, bcaz it beyond 2 u.

18.We have to pray God to provide all aminities to our neighours and enemies more than ourselves. Then the question of Gealous and Ego does not arise.  Only Happy.

19.Every little smile can touch somebody's heart. No one is born Happy. Bt all of us are born with the ability to create happiness.

20. We always feel that life of others is Better than us..! But, we always forget that we are also "Others" for someone else.

21. The greatest gift in life is to find someone who knows all ur faults,differences,mistakes and many more wrongs about you. But still sees the best in U.

22. Three words can narrate the best meaning of life "Expectation kills relation". The Right temperature in a relation is maintained by WARM HEARTS, NOT BY WARM HEADS.

23.Never blame anyone in your life, Gud people in give happiness, Bad people give Experience,Worst people give U A lesson, and Best people give u memories.

 

Wednesday, July 20, 2011

How to do doubleClick on WebElement , WindowMaxmize Using Webdriver

 To maximize the active Window :

public void windowMaximize() {
((JavascriptExecutor) driver).executeScript("if (window.screen){window.moveTo(0, 0);window.resizeTo(window.screen.availWidth,window.screen.availHeight);};");
}

To DoubleClick an Element

public void doubleClick(WebElement webElement) {
//For FF browser.
((JavascriptExecutor)driver).executeScript("var evt = document.createEvent('MouseEvents');"
+ "evt.initMouseEvent('dblclick',true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0,null);"
+ "arguments[0].dispatchEvent(evt);",webElement);

//For IE
//((JavascriptExecutor)driver).executeScript("arguments[0].fireEvent('ondblclick');", webElement);
}

Monday, July 11, 2011

Selenium - Ajax , Selenium - Dojo, ...

Ref: http://www.ibm.com/developerworks/opensource/library/os-webautoselenium/index.html?ca=drs-

Friday, June 3, 2011

how-to-locate-element-which-have-same.html

http://automationtricks.blogspot.com/2010/09/how-to-locate-element-which-have-same.html

Selenium Regular Expression

Selenium supports a few methods that help match text patterns. However, selenium locators don’t accept regular expressions. Only patterns or values accept them.
Globbing:
selenium.click("link=glob:*Gifts"); // Clicks on any link with text suffixed with 'Gifts'
selenium.verifyTextPresent("glob:*Gifts*");
Regular Expressions:[regexp, regexpi]
selenium.click("link=regexpi:^Over \\$[0-9]+$");  //matches links such as 'Over $75', 'Over $85' etc
Contains:
selenium.highlight("//div[contains(@class,'cnn_sectbin')]");  //highlights the first div with class attribute that contains 'cnn_sectbin'
selenium.highlight("css=div#cat_description:contains(\"to last\")");  //locating a div containing the text 'to last' using css selector
Starts-with:
selenium.click("//img[starts-with(@id,'cat_prod_image')]");  //clicks on the first image that has an id attribute that starts with 'cat_prod_image'
selenium.click("//div[starts-with(@id,'tab_dropdown')]/a[last()]");  //clicks on the last link within the div that has a class attribute starting with 'tab_dropdown'
selenium.click("//div[starts-with(@id,'tab_dropdown')]/a[position()=2]"); //clicks on the second link within the div that has a class attribute starting with 'tab_dropdown'
selenium.highlight("css=div[class^='samples']"); //highlights div with class that starts with 'samples'
Ends-with:
selenium.highlight("css=div[class$='fabrics']"); //highlights div with class that ends with 'fabrics'
selenium.click("//img[ends-with(@id,'cat_prod_image')]"); //clicks on the first image that has an id attribute that ends with 'cat_prod_image'
[Note: ends-with is supported only by Xpath 2.0. FF 3 might throw an error for this.]
Ref: http://blog.browsermob.com/2011/02/regular-expressions-and-pattern-matching-with-browsermob-and-selenium/

Way to Get XPATH in IE

Are you stuck with an application that only works in IE?
Do you want the XPATH of an element that can be seen only IE? Unable to replicate the scenario in firefox. There are many firefox addons like xpather, xpath-checker and firebug that will give you the xpath of an element in a second. But sadly there is no addon or tool avaialable that will do this for IE. For most cases you can get the xpath of the elements that fall in your script using the above tools in firefox and tweak them a little (if required) to make them work in IE. But if you are testing an application that will work only in IE or the specific scenario or page that has this element will open-up/play-out only in IE then you cannot use any of the above mentione tools to find the XPATH.
Well the only thing that works in this case is the Bookmarklets that were coded just for this purpose. Bookmarklets are JavaScript code that you will add in IE as bookmarks and later use to get the XPATH of the element you desire. Using these you can get the XPATH as easily as you get using xpather or any other firefox addon.

STEPS TO INSTAL BOOKMARKLETS
1)Open IE
2)Type about:blank in the address bar and hit enter
3)From Favorites main menu select--->Add favorites
4) In the Add a favorite popup window enter name GetXPATH1.
5)Click add button in the add a favorite popup window.
6)Open the Favorites menu and right click the newly added favorite and select properties option.
7)GetXPATH1 Properties will open up. Select the web Document Tab.
8)Enter the following in the URL field.

javascript:function getNode(node){var nodeExpr=node.tagName;if(!nodeExpr)return null;if(node.id!=''){nodeExpr+="[@id='"+node.id+"']";return "/"+nodeExpr;}var rank=1;var ps=node.previousSibling;while(ps){if(ps.tagName==node.tagName){rank++;}ps=ps.previousSibling;}if(rank>1){nodeExpr+='['+rank+']';}else{var ns=node.nextSibling;while(ns){if(ns.tagName==node.tagName){nodeExpr+='[1]';break;}ns=ns.nextSibling;}}return nodeExpr;}

9)Click Ok. Click YES on the popup alert.
10)Add another favorite by following steps 3 to 5, Name this favorite GetXPATH2 (step4)
11)Repeat steps 6 and 7 for GetXPATH2 that you just created.
12)Enter the following in the URL field for GetXPATH2

javascript:function o__o(){var currentNode=document.selection.createRange().parentElement();var path=[];while(currentNode){var pe=getNode(currentNode);if(pe){path.push(pe);if(pe.indexOf('@id')!=-1)break;}currentNode=currentNode.parentNode;}var xpath="/"+path.reverse().join('/');clipboardData.setData("Text", xpath);}o__o();

13)Repeat Step 9.

You are all done!!

Now to get the XPATH of elements just select the element with your mouse. This would involve clicking the left mouse button just before the element (link, button, image, checkbox, text etc) begins and dragging it till the element ends. Once you do this first select the favorite GetXPATH1 from the favorites menu and then select the second favorite GetXPATH2. At his point you will get a confirmation, hit allow access button. Now open up a notepad file, right click and select paste option. This will give you the XPATH of the element you seek.


*I got this bookmarklets from some other site but can't remember which one. Credit goes to the guy who created these JS.
 
Ref: http://deepintoselenium.blogspot.com/2011/05/way-to-get-xpath-in-ie.html
 

Wednesday, May 11, 2011

Quotes I received from my friends

1. A smile Is the LightingSystem of the Face, Cooling System of Head And Healing System of Heart. Keep Smiling always , make other HAPPY UPTO UR LEVEL.
2.Sharing problems & Asking for help, doesn't mean that we are weak or incompetent.It indicates an advanced level of trust and faithon frnds.
3.Choosing so many wrong person will not affect your life,but missing one right person will leave you a broken heart through out your life :).
4.A man to Vivekananda, "What is the reason for every misunderstanding?" Vivekananda: The reason is, we see the people as we are but not as they r!.
5.Person should have some frnds R relatives Those really feel JOY 2 ur SUCCESS & SORRY to ur FAILURE without EGO 2ur SUCCESS & TEAJING2 ur FAILURE.
6.Be happy with what you have..while working for what you want..Remember , a happy and successful life..begins with Good and ends for God.
7.Successful people don't plan results. They only plan right beginnings. Right results always follow right beginings. ave a right begining.
8.Good RELATIONS & FRIENDSHIPS are like Needles of clock. They only meet Sometime just twice in a day but at the end they always stay connected.
9.Beautiful truth:- "The Heart feels light when someone lives in it..!  But feels very heavy when someone leaves it..!
10.Learn from pair of walking legs. The foot that is frward has No Pride and the Foot which is behing has no Shame bcoz they both know that situation changes soon.
11.Every successful person is not lucky. Success is a result of hardwork,dont belive in luch! Efforts never fails. Hardwork always wins.
12.A person with a pure heart can have a wonderful smile that makes even enemy 2 feel himself guilty for being enemy. So catch the world with your smile.
13.Whome u don't need today , u may need them tomorrow.But whome you neglect today , they will never again accept you tomorrow. Love everyday your sweet and true people.
14.Successful people always have 2 things on their lips 1. Silence and 2. Smile. Smile 2 solve the problem and Silence to avoid the problem. Keep Smile and Silence.
15. A single work spoken at the time of anger is more poisonous, which makes us forget the 100 loveble conversions b/n 2, within a minute. THINK A WHILE AT ANGER.
16. Argument is bad but, Discussion is good; beacouse Argument is to find out WHO is right! Discussion si to find out WHAT is right!
17."2Get" & "2Give" creates too many problems. But (just Double it) "4Get" & "4Give" solves all the problems. B happy live happy & make others happy.
18.Beautiful tomorrow Never Comes , When It Comes It's Already today. InHunt of Beautiful tomorrow. Lets Not Waste The Wonderful today.

Tuesday, May 3, 2011

WebDriver PageFactory.initElements [Why we need]

GooglePage.java
 public class GooglePage extends MyDriver{    
      @FindBy(how = How.NAME, using = "q")  
       private WebElement searchtext;  
      public GooglePage() {  
             super();
             System.out.println("cool stuff!");  
      }  
       public void typeText(){  
           searchtext.sendKeys("abc"); 
      }  
 } 
Testcode:
public class TestCode{
public TestCode(){
GooglePage googlePage = PageFactory.initElements(driver, GooglePage.class); 
//We need to use PageFactory.initElements(driver, GooglePage.class) 
// instead of "new GooglePage() since the GooglePage defines the WebElement using @FindBy. 
    public void testCase1(){
   googlePage.typeText();
   .... 
  }
} 



Wednesday, April 27, 2011

Sample Ant build file to run TestNG

Ref: http://openwritings.net/public/testng/ant-build-file-testng 
 
 version="1.0" encoding="UTF-8"?>

 basedir="." default="runTestNG" name="Sample of Ant file for TestNG">
 
  
   name="testng" classname="org.testng.TestNGAntTask">
    >
       location="lib/testng/testng-5.14.7.jar"/>
    >
  >
 
  
   name="testng.output.dir" value="testng_output"/>
 
  
   id="classes">
      location="bin"/>
  >
 
  
   name="runTestNG">
 
     dir="${testng.output.dir}"/>
 
     outputdir="${testng.output.dir}" classpathref="classes"> 
       dir="." includes="testng.xml"/> 
    >
 
  >
 
>

TestNG Report using TestNG-XSLT

Refer: http://code.google.com/p/testng-xslt/

Reference: http://openwritings.net/public/testng/ant-build-using-testng-xslt

 name="testng_nice_report">
   dir="testng_nice_report"/>
   in="testng_output/testng-results.xml" 
        style="lib/testng-xslt-0.6.2/src/main/resources/testng-results.xsl"
        out="testng_nice_report/index.html">
     name="testNgXslt.outputDir" expression="${basedir}/testng_nice_report"/>
     name="testNgXslt.showRuntimeTotals" expression="true"/>
     refid="MyClasspath"/>
  >
>
 
 
 
http://bradjsimpson.blogspot.com/2010/09/generating-selenium-reports-using.html 

Tuesday, April 26, 2011

Thursday, April 7, 2011

Anna Hazare - A mail from Kiran Bedi and Anna Hazare(indiaagainstcorruption.2010@gmail.com)

Anna Hazare fasts unto death starting 5th April.
He is demanding enactment of a strong anti-corruption law - Jan Lokpal Bill - to ensure swiftness and certainty of punishment to the corrupt.
Will his fast have any impact on the deaf  Government of India?
Yes, it certainly would. Because, last time when Anna sat on fast -
                 * 6 corrupt ministers in Maharashtra had to resign
                 * 400 corrupt officers were dismissed from job
                 * 2002 - Maharashtra RTI Act was passed
                 * 2006 - Central Government withdrew its proposal to amend Central RTI Act

Now Anna is fasting to demand Jan Lokpal Bill.
  JAN LOKPAL BILL will act as deterrent and instill fear in the minds of corrupt people.

"At 78, Anna is not fasting for himself, he is fasting for the future of my kid. I will myself fast on 5th April for a day and ask my 5 year daughter also to skip a meal on 5th April," Rakesh, a software engineer.



What can you do?

"Let the whole nation fast for a day on 5th April and pray for a corruption free India. Collective prayers are very powerful. Let the whole nation pray against corruption," appeals Anna Hazare.

"Lets reach Jantar Mantar in thousands, in lakhs from 5th April. I will be there - day and night - with Anna. We will all sleep on the roads of Jantar Mantar. Anna's fast can change India's history. Can't you take a few days off from your work and be a part of it?" Arvind Kejriwal

"Send us a missed call at 02261550789 to stay updated about this movement. Forward this mail to everyone," Kiran Bedi
Do watch this film: http://www.youtube.com/watch?v=2eJnyPRWHzc<http://www.katalistdigital.com/iem/link.php?M=306709&N=97&L=71&F=H>

Across India, join Sri Sri Ravishankar, Swami Agnivesh, Arch Bishop of Delhi Vincent Concessao, Mahmood A Madani, Kiran Bedi, J M Lyngdoh, Shanti Bhushan, Prashant Bhushan, Arvind Kejriwal, Mufti Shamoom Qasmi, Mallika Sarabhai, Arun Bhatia, Sunita Godara, Swami Ramdev, All India Bank Employees Federation, PAN IIT Alumni Association, Common Cause, Foundation for Restoration of National Values and many other prominent organizations and leaders, as India comes out on the streets!
200+ CITIES WILL RALLY BEHIND ANNA!

Salient features of Jan Lokpal Bill

Drafted by Justice Santosh Hegde, Prashant Bhushan and Arvind Kejriwal, this Bill has been refined on the basis of feedback received from public on website and after series of public consultations. It has also been vetted by and is supported by Shanti Bhushan, J M Lyngdoh, Kiran Bedi, Anna Hazare etc. It was sent to the PM and all CMs on 1st December.

1.      An institution called LOKPAL at the centre and LOKAYUKTA in each state will be set up
2.      Like Supreme Court and Election Commission, they will be completely independent of the governments. No minister or bureaucrat will be able to influence their investigations.
3.      Cases against corrupt people will not linger on for years anymore: Investigations in any case will have to be completed in one year. Trial should be completed in next one year so that the corrupt politician, officer or judge is sent to jail within two years.
4.      The loss that a corrupt person caused to the government will be recovered at the time of conviction.
5.      How will it help a common citizen: If any work of any citizen is not done in prescribed time in any government office, Lokpal will impose financial penalty on guilty officers, which will be given as compensation to the complainant.
6.      So, you could approach Lokpal if your ration card or passport or voter card is not being made or if police is not registering your case or any other work is not being done in prescribed time. Lokpal will have to get it done in a month's time. You could also report any case of corruption to Lokpal like ration being siphoned off, poor quality roads been constructed or panchayat funds being siphoned off. Lokpal will have to complete its investigations in a year, trial will be over in next one year and the guilty will go to jail within two years.
7.      But won't the government appoint corrupt and weak people as Lokpal members? That won't be possible because its members will be selected by judges, citizens and constitutional authorities and not by politicians, through a completely transparent and participatory process.
8.      What if some officer in Lokpal becomes corrupt? The entire functioning of Lokpal/ Lokayukta will be completely transparent. Any complaint against any officer of Lokpal shall be investigated and the officer dismissed within two months.
9.      What will happen to existing anti-corruption agencies? CVC, departmental vigilance and anti-corruption branch of CBI will be merged into Lokpal. Lokpal will have complete powers and machinery to independently investigate and prosecute any officer, judge or politician.

Tuesday, April 5, 2011

13. This summer it has crossed 45degree . Many birds die due to lack of water. Plz keep bowl of water in balcony. Hope you will do it.

14.People lose their health for making money. The same money is lost for restoring their health. But the secret in this issue is - They are loosing the valuable Time. Never get again.

15.Never think and speak about the third person who was not there and never thing what the third person thinks and speaks about U. When U were not there.

16. If the world refuses to help U, just remember the words of Einstein "I'm thankful 2 all those who said no 2 me, because of them only i did it myself.

Thursday, March 31, 2011

Get total number of rows from a HtmlTable - Webdriver

Below code can be used to get rowcount from a Html table. If table not exists returns -1.

private int getRowCount(By by) throws Exception {
        try {
            WebElement table = driver.findElement(by);
            List rows = table.findElements(By.tagName("tr"));
            return rows.size();
        } catch (Exception e) {
            return -1;
        }

    }

Friday, March 18, 2011

Clear contents and input a value webdriver

public void inputValue(WebElement txtbox
 ,String value) throws Exception{ 
txtbox
.sendKeys(Keys.chord(Keys.CONTROL, "a"), value);
}

Thursday, February 24, 2011

WebDriver - Handling listboxes

1. Select value from a listbox

public void selectValue(WebElement listbox, String value) {
        if (listbox != null && !value.isEmpty()) {
            List listValues = listbox.findElements(By.tagName("option"));
            for (WebElement option : listValues) {
                if (option.getText().equals(value)) {
                    option.setSelected();
                    break;
                }
            }
        }
    }


2. Get selected value from listbox

public String getSelectedValue(WebElement listbox) throws MyException {
        if (listbox == null) {
            throw new MyException("listboxValues = " + listbox);
        }
        List options = listbox.findElements(By.tagName("option"));
        for (WebElement option : options) {
            if (option.isSelected())
                return option.getText();
        }
        return null;
    }


3. Verfiy for a value in listbox
public boolean verifyListboxValue(WebElement listbox,String value) throws IllegalArgumentException {
        if (listbox == null) {
            throw new IllegalArgumentException("listboxValues = " + listbox);
        }
        List options = listbox.findElements(By.tagName("option"));
        for (WebElement option : options) {
            if (option.getText().equals(value))
                return true;
        }
        return false;
    }


 class MyException extends Exception{
.....
}

Thursday, February 17, 2011

Selenium RC supporting for Https certificate issue

Download latest selenium1.0.x and include the following code while starting selenium server from code.

RemoteControlConfiguration rcc = new RemoteControlConfiguration();
rcc.setTrustAllSSLCertificates(true);
seleniumServer = new SeleniumServer(rcc);
seleniumServer.start();

Wednesday, February 16, 2011

Accepting Untrusted Certificates - Https Webdriver firefox

Code for resolving https issue :
1. Create a firefox new profile
Refer http://kb.mozillazine.org/Creating_a_new_Firefox_profile_on_Windows

Open firefox , open your application and accept the cerificate manually.
Now add below code in your script (assuming the newly created profile name is WebDriver2).

ProfilesIni allProfiles = new ProfilesIni();
FirefoxProfile profile = allProfiles.getProfile("WebDriver2");
profile.setAcceptUntrustedCertificates(false);
WebDriver driver = new FirefoxDriver(profile);


Wednesday, February 9, 2011

Selenium Tutorial

This tutorial explains how to use write selenium tests using frameworks like Junit , TestNG with Ant. Hope by the end of tutorial you will get a base framework to start your tests for your application under test.
First of all take your own time and go through the entire document available at http://seleniumhq.org/docs/index.html.
Now starts with Installation of required artifacts.



  1. Installing eclipse
    Your computer should have a working Java Runtime Environment (JRE) v6 to run Eclipse. If you do not already have it, follow the instructions for installing Java 6 before installing Eclipse. Regardless of whether or not you had an existing, prior version of Eclipse, click to open the local zip archive of the Eclipse program so that you can view the folder. Once downloaded zip file , extract the zip contents into a folder (eg: c:\eclipse ). Open eclipse editor by doubleclick eclipse.exe.