Tag Archives: webdriver.ie.driver

How to send keyboard keys combination in selenium webdriver (java)?

Problem? 😦

How to send keyboard keys combination in selenium webdriver (java)?

Solution: 🙂

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
public class TestKeyboardKeysCombination {
public static void main(String[] args) throws InterruptedException {
 DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
 capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
 System.setProperty("webdriver.ie.driver", "C://IEDriverServer.exe");
 WebDriver myTestDriver = new InternetExplorerDriver(capabilities);
 myTestDriver.get("https://www.google.com/");
 myTestDriver.manage().window().maximize();
 myTestDriver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);

 myTestDriver.findElement(By.xpath("//*[@id='gs_tti0']")).sendKeys(Keys.NUMPAD1, Keys.ADD, Keys.NUMPAD9, Keys.EQUALS,Keys.ENTER);
 Thread.sleep(10000L);
 myTestDriver.quit();
}
}

 

How to send keyboard keys combination in selenium webdriver (java)?

How to send keyboard keys combination in selenium webdriver (java)?

Advertisements

How do I start the Internet Explorer WebDriver for Selenium ?

Problem:

We want to run our test cases on Internet Explorer browser using selenium WebDriver.

Solution:

Lets Try to do it same as we did for FireFox browser.

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
public class IEtestforDesiredCapabilities {

 public static void main(String[] args) {

WebDriver driver = new InternetExplorerDriver();
 driver.manage().window().maximize();
 driver.get("http://google.com");

 driver.quit();
 }

}

Now run this code from Eclipse. And check out the console.

It will thrown Error

The path to the driver executable must be set by the webdriver.ie.driver system property; for more information, see http://code.google.com/p/selenium/wiki/InternetExplorerDriver. The latest version can be downloaded from http://code.google.com/p/selenium/downloads/list
Dec 11, 2012 12:59:43 PM org.openqa.selenium.ie.InternetExplorerDriverServer initializeLib
WARNING: This method of starting the IE driver is deprecated and will be removed in selenium 2.26. Please download the IEDriverServer.exe from http://code.google.com/p/selenium/downloads/list and ensure that it is in your PATH.
Exception in thread "main" org.openqa.selenium.WebDriverException: Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones. Enable Protected Mode must be set to the same value (enabled or disabled) for all zones. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.21 seconds
Build info: version: '2.25.0', revision: '17482', time: '2012-07-18 21:09:54'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_05'
Driver info: driver.version: InternetExplorerDriver
Session ID: b0f78d3b-1ed2-4ace-ba9b-4c4063cf871b
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
 at java.lang.reflect.Constructor.newInstance(Unknown Source)
 at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:188)
 at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
 at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:498)
 at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:182)
 at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:167)
 at org.openqa.selenium.ie.InternetExplorerDriver.startSession(InternetExplorerDriver.java:133)
 at org.openqa.selenium.ie.InternetExplorerDriver.setup(InternetExplorerDriver.java:106)
 at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:52)
 at IEtestforDesiredCapabilities.main(IEtestforDesiredCapabilities.java:12)

Protected Mode settings are not the same for all zones

Protected Mode settings are not the same for all zones

So we have one question in our mind……

I have Question

INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS

How can we do this ? How can we set this programmatically?

The solution is give in that error.

Download InternetExplorerDriver standalone server for 32-bit IE OR InternetExplorerDriver standalone server for 64-bit IE

And put this IEDriverServer.exe to appropriate drive. We put in C:/ drive in this example

Now few more things to know which we are going to resolve this issue

Class DesiredCapabilities and method of this class internetExplorer()
setCapability
System.setProperty
InternetExplorerDriver(capabilities)

This slideshow requires JavaScript.

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
public class IEtestforDesiredCapabilities {

 public static void main(String[] args) {

 // Method and Description - static DesiredCapabilities internetExplorer()
 DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();

 //Method and Description - void setCapability(java.lang.String capabilityName, boolean value)
 capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);

 //Among the facilities provided by the System class are standard input, standard output, and error output streams; access to externally defined "properties"; a means of loading files and libraries; and a utility method for quickly copying a portion of an array.
 System.setProperty("webdriver.ie.driver", "C:\\IEDriverServer.exe");

 //InternetExplorerDriver(Capabilities capabilities)
 WebDriver driver = new InternetExplorerDriver(capabilities);

 driver.manage().window().maximize();
 driver.get("http://google.com");

 driver.quit();
 }

}

The END

Pupunzi

For a better web

Tech

News and reviews from the world of gadgets, gear, apps and the web

VentureBeat

News About Tech, Money and Innovation

Digital Inspiration

Tips and tutorials around all things tech.

Thinkwareglobal's Blog

Just another WordPress.com weblog

Kenazari's Blog

Just another WordPress.com weblog

Richfowler1's Blog

Just another WordPress.com weblog

Romaicus's Blog

Just another WordPress.com weblog

botlaguduri

Just another WordPress.com site

chandanag89

Just another WordPress.com site

meghshetty

Just another WordPress.com site

digitalmediaexpert

digital media expert blog

Thinking in Silverlight

Silverlight/WPF/Windows 8 Store App

Different Journeys

Let's make life easier!

LAW RESOURCE INDIA

LEGAL RESOURCE CENTRE / COURT JUDGMENTS / LEGAL ARCHIVES

BookConnect

Promoting Indian language Books

Actively Lazy

Software, crafted with passion

SAPonPower

An ongoing discussion about SAP infrastructure

SAP Career

Your Career Mentor

hrsapcertification

Just another WordPress.com site

The secret product manager

Thoughts about product management, SUSE, Linux, ARM processors, Cloud, AIX, Power Systems, and other things that interest me

Sap Certification Material . Com

Quality store for sap software and courses

Simon Les Flex's Blog

SAP Process Integration Specialist - NOW WE CAN DO BETTER!

Oracle Technologies Primer

An Oracle Fusion Middleware and iPaaS blog!

Gilberto Holms

Java, Middleware, SOA Architecture Blog

The Skeleton

Java code skeletons, tips and pointers

J@n van Zoggel

integration, innovation & random technology stuff

The Pragmatic Integrator

Hints and tips from a pragmatic integration specialist

briskwalk

The pace of life..

Optimalbg's Blog

Just another WordPress.com site

IT Jobs in USA

Keep the track of this Blog if you are looking out for some good Opportunities to work in USA....

Referral Jobs | Right Place to Get a Job

Hurry you are one Click away to get a job - Fresher Jobs for 2012, 2013 fresher’s and also high paid jobs for well Experienced IT professionals on Referal jobs.

eccinternational.wordpress.com/

ISO Consulting | ISO 27001 | ISO 20000 | CMMI | BCM | GRI Sustainability Reporting & Assurance | eLearning | Trainings | Philippines

Michael Korn's Blog

Musings on Life, Career, Faith and Technology

WORKINGWITHQTP

Just another WordPress.com weblog

Topics

.Net Core, AspNetCore, Entity Framework, Entity Framework Core, AspNetIdentity, AspNetIdentityCore, Unit Test, WCF, Workflows

SQA and Testers Blog

Just another WordPress.com weblog

Expertqtp's Weblog

Just another WordPress.com weblog

Sai Chamarthi

Experienced Testing Professional

saxenavinay

A great WordPress.com site

Suresh4qtp's Blog

Just another WordPress.com site

jonah95hill

This WordPress.com site is the cat’s pajamas

It's always something...

Just another WordPress.com weblog

Faculty of Information Technology - Lê Ngọc Tiến

Be Yourself! Simplify Our Goals! Nothing is Impossible!

Anti-Malware Testing

Thoughts on security product testing past and present

Methods & Tools

Practical knowledge for the software developer, tester and project manager