Tag Archives: JavascriptExecutor

How to Change the value of Applet using JavaScriptExecutor using Selenium Webdriver? – Learn By Example

Please refer example site used in this blog LINK

Javascript and Applet interaction

public class appletTestingWebdriver {
 public static void main(String[] args) throws InterruptedException {

 WebDriver myTestDriver = new FirefoxDriver();
 myTestDriver.manage().window().maximize();

 myTestDriver.navigate().to("http://tinyurl.com/2v5pzuh");

 Thread.sleep(5000L);
 JavascriptExecutor js = (JavascriptExecutor) myTestDriver;
 js.executeScript("document.jsap.setText(document.forms[0].txt1.value);");

}

}

How to do JavaScript and Applet interaction using Selenium Webdriver? – Learn by example

How to do JavaScript and Applet interaction using Selenium Webdriver?

How to Change the value of Applet using JavaScriptExecutor using Selenium Webdriver?

Please refer Example Website used in this example LINK

Sender Applet Receiver Applet 2

In above example image java applet have one counter increment button and one receiver label which displays incremented counter value.

We make program which perform same function as by Click to increment  counter button.

communication between javascript and applet

 public class AppletExample {
 public static void main(String[] args) throws InterruptedException {

 WebDriver myTestDriver = new FirefoxDriver();
 myTestDriver.manage().window().maximize();

 myTestDriver.navigate().to("http://tinyurl.com/ct697n7");

 JavascriptExecutor js = (JavascriptExecutor) myTestDriver;
 js.executeScript("receiver.incrementCounter();");
 js.executeScript("receiver.incrementCounter();");
 js.executeScript("receiver.incrementCounter();");
 js.executeScript("receiver.incrementCounter();");
 js.executeScript("receiver.incrementCounter();");
 js.executeScript("receiver.incrementCounter();");

 }
}

Learn by example – how to use javascriptexecutor for JavaScript in Selenium tests? – Selenium webdriver

Did you know you can execute JavaScript code inside a Selenium test?  Here is how you can accomplish this using the WebDriver object:

Learn by examples

Learn by examples

 

 

 

 

 

 

 

 

 

 

display current date on browser

import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class displayDate {
 public static void main(String[] args) throws InterruptedException {
 WebDriver driver;
 driver = new FirefoxDriver();
 JavascriptExecutor js = (JavascriptExecutor) driver;

 js.executeScript("document.write(Date());");


 }

}

display current date on Alert box

import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class displayDate {
 public static void main(String[] args) throws InterruptedException {
 WebDriver driver;
 driver = new FirefoxDriver();
 JavascriptExecutor js = (JavascriptExecutor) driver;

 js.executeScript("alert(Date());");


 }

}

 

 

References

 

 

 

 

 

 

Reference 1

Pupunzi

For a better web

Tech

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

Digital Inspiration

Technology, Software and Internet

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

Different Journeys

Let's make life easier!

Thinking in Silverlight

Silverlight/WPF/Windows 8 Store App

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, Linux, Arm processors, Embedded OS, Photography, Scouts BSA, Cloud, and other things that interest me

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

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 and High paid jobs for well Experienced IT professionals on Referal jobs.

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

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

Mindscripts Software Testing Training Institutes In Pune

Software Testing In Pune, Software Testing Training In Pune, Software Testing Training Institute,Software Testing Training Institutes In Pune ,Software Testing Training Centers,Software Testing Classes In Pune,,Software Testing Courses Pune, Software Testing Certification In Pune,,software testing certification course in pune,software testing certification institutes in pune

edington associates

Working with organizations to develop sustainable and thriving workplaces and people.

Main Admin Site for the WPVIP multisite

This multisite hosts public sites for Parse.ly and WordPress VIP

WORK Online

Virtual Office at HOME

SysfoData

Software Development, Web Development and Internet Marketing Service Available here.

Birth Pangs of a Startup

Virtual Assistance, Startups, Technology, Online Work and More