How to clone Selenium Webdriver using Java language ? Is it Possible or not ?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to clone Selenium Webdriver using Java language ? Is it Possible or not ?

Poovaraj Thangamariappan
Hi Team,

I want to clone Selenium Webdriver using Java language. I have written below code. Can you please help me how to clone webdriver ?  Is it possible or not ? Please correct me if it is wrong ?

Code :-

package Selenium_Program;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class demo_WebDriver_Cloning implements Cloneable
{
public static WebDriver driver;
public static WebDriver driver1;

demo_WebDriver_Cloning(WebDriver driver)
{
this.driver=driver;
}
@Override
public Object clone() throws CloneNotSupportedException
{
return (demo_WebDriver_Cloning)super.clone();
}
public static void main(String[] args)
{
try
{
// TODO Auto-generated method stub
 demo_WebDriver_Cloning obj = new demo_WebDriver_Cloning(driver);
 System.setProperty("webdriver.gecko.driver", "D:\\Working\\Selenium\\geckodriver.exe");
 driver=new FirefoxDriver(); 
 driver.get("https://www.google.co.in/");  
 
 driver1 = (demo_WebDriver_Cloning)driver.clone();
 driver1.get("https://www.facebook.com/");
 
}catch(Exception e)
{
}
}

}

Thanks in Advance !

Regards,
Poovaraj

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAMu9-ZW2Kn7u5oFmdPdzRG5G1heF5m%2BeUtMSCB8OkkMZXiiZiw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to clone Selenium Webdriver using Java language ? Is it Possible or not ?

Krishnan Mahadevan

Can you please help elaborate your use case ? What exactly are you trying to do ?

 

Your cloning mechanism wont work, because you have merely invoked a super.clone() (here your super is basically the Cloneable interface and it doesn’t have any implementation).

You would need to write code such that the clone() implementation creates another WebDriver instance and returns it optionally doing the following :

 

  • Open the same URL as the original instance
  • Copy the cookies if applicable/relevant
  • Duplicate the window size etc.,

 

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

 

From: <[hidden email]> on behalf of Poovaraj Thangamariappan <[hidden email]>
Reply-To: <[hidden email]>
Date: Saturday, May 27, 2017 at 9:58 AM
To: <[hidden email]>
Subject: [selenium-users] How to clone Selenium Webdriver using Java language ? Is it Possible or not ?

 

Hi Team,

 

I want to clone Selenium Webdriver using Java language. I have written below code. Can you please help me how to clone webdriver ?  Is it possible or not ? Please correct me if it is wrong ?

 

Code :-

 

package Selenium_Program;

 

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.chrome.ChromeDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

 

public class demo_WebDriver_Cloning implements Cloneable

{

            public static WebDriver driver;

            public static WebDriver driver1;

 

            demo_WebDriver_Cloning(WebDriver driver)

            {

                        this.driver=driver;

            }

           

            @Override

            public Object clone() throws CloneNotSupportedException

            {

                        return (demo_WebDriver_Cloning)super.clone();

            }

           

            public static void main(String[] args)

            {

                       

                        try

                        {                                 

                       

                        // TODO Auto-generated method stub

                         demo_WebDriver_Cloning obj = new demo_WebDriver_Cloning(driver);                                    

                         System.setProperty("webdriver.gecko.driver", "D:\\Working\\Selenium\\geckodriver.exe");

                         driver=new FirefoxDriver(); 

                         driver.get("https://www.google.co.in/");                     

                                   

                         

                         driver1 = (demo_WebDriver_Cloning)driver.clone();

                         driver1.get("https://www.facebook.com/");

                         

                        }catch(Exception e)

                        {

                                   

                        }

            }

 

}

 

Thanks in Advance !

 

Regards,

Poovaraj

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAMu9-ZW2Kn7u5oFmdPdzRG5G1heF5m%2BeUtMSCB8OkkMZXiiZiw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/D10D3CA6-10AF-46C7-ABEF-DB8890E4D8BD%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to clone Selenium Webdriver using Java language ? Is it Possible or not ?

Xiang Dong
In reply to this post by Poovaraj Thangamariappan

Not sure what do your really want? WebDriver instance is just a Java object but the object itself bind a Web Browser instance. The driver instance is used to manipulate the browser instance for various test actions. Never try clone one because you are not able to clone one browser instance. If you want to two webdriver instances, you just need to create two. If you want to one browser open two tabs for different website. it is possible.


--david




From: [hidden email] <[hidden email]> on behalf of Poovaraj Thangamariappan <[hidden email]>
Sent: Saturday, May 27, 2017 12:28 PM
To: [hidden email]
Subject: [selenium-users] How to clone Selenium Webdriver using Java language ? Is it Possible or not ?
 
Hi Team,

I want to clone Selenium Webdriver using Java language. I have written below code. Can you please help me how to clone webdriver ?  Is it possible or not ? Please correct me if it is wrong ?

Code :-

package Selenium_Program;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class demo_WebDriver_Cloning implements Cloneable
{
public static WebDriver driver;
public static WebDriver driver1;

demo_WebDriver_Cloning(WebDriver driver)
{
this.driver=driver;
}
@Override
public Object clone() throws CloneNotSupportedException
{
return (demo_WebDriver_Cloning)super.clone();
}
public static void main(String[] args)
{
try
{
// TODO Auto-generated method stub
 demo_WebDriver_Cloning obj = new demo_WebDriver_Cloning(driver);
 System.setProperty("webdriver.gecko.driver", "D:\\Working\\Selenium\\geckodriver.exe");
 driver=new FirefoxDriver(); 
 driver.get("https://www.google.co.in/");  

 
 driver1 = (demo_WebDriver_Cloning)driver.clone();
 driver1.get("https://www.facebook.com/");

 
}catch(Exception e)
{
}
}

}

Thanks in Advance !

Regards,
Poovaraj

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAMu9-ZW2Kn7u5oFmdPdzRG5G1heF5m%2BeUtMSCB8OkkMZXiiZiw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/HKXPR03MB224872DF24CDD76E0B33406D90FD0%40HKXPR03MB2248.apcprd03.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to clone Selenium Webdriver using Java language ? Is it Possible or not ?

Poovaraj Thangamariappan
In reply to this post by Krishnan Mahadevan
Hi Krishnan Mahadevan,

Thanks for your reply.  I have to validate 2 application simultaneously using single driver.  

Scenarios :-

  • Login into application and Updated in Email ID in first application
  • I have to open second application and verify email id is updated or not
  • Again, I have to move first application and updated in account number
  • verify account number in second application 


* I cannot use SwitchToWindow and SwitchToFrame option in this scenarios 
  
  How to handle this scenario without using 2 webdriver instance ? 


Regards,
Poovaraj

On Sat, May 27, 2017 at 10:08 AM, Krishnan Mahadevan <[hidden email]> wrote:

Can you please help elaborate your use case ? What exactly are you trying to do ?

 

Your cloning mechanism wont work, because you have merely invoked a super.clone() (here your super is basically the Cloneable interface and it doesn’t have any implementation).

You would need to write code such that the clone() implementation creates another WebDriver instance and returns it optionally doing the following :

 

  • Open the same URL as the original instance
  • Copy the cookies if applicable/relevant
  • Duplicate the window size etc.,

 

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

 

From: <[hidden email]> on behalf of Poovaraj Thangamariappan <[hidden email]>
Reply-To: <[hidden email]>
Date: Saturday, May 27, 2017 at 9:58 AM
To: <[hidden email]>
Subject: [selenium-users] How to clone Selenium Webdriver using Java language ? Is it Possible or not ?

 

Hi Team,

 

I want to clone Selenium Webdriver using Java language. I have written below code. Can you please help me how to clone webdriver ?  Is it possible or not ? Please correct me if it is wrong ?

 

Code :-

 

package Selenium_Program;

 

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.chrome.ChromeDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

 

public class demo_WebDriver_Cloning implements Cloneable

{

            public static WebDriver driver;

            public static WebDriver driver1;

 

            demo_WebDriver_Cloning(WebDriver driver)

            {

                        this.driver=driver;

            }

           

            @Override

            public Object clone() throws CloneNotSupportedException

            {

                        return (demo_WebDriver_Cloning)super.clone();

            }

           

            public static void main(String[] args)

            {

                       

                        try

                        {                                 

                       

                        // TODO Auto-generated method stub

                         demo_WebDriver_Cloning obj = new demo_WebDriver_Cloning(driver);                                    

                         System.setProperty("webdriver.gecko.driver", "D:\\Working\\Selenium\\geckodriver.exe");

                         driver=new FirefoxDriver(); 

                         driver.get("https://www.google.co.in/");                     

                                   

                         

                         driver1 = (demo_WebDriver_Cloning)driver.clone();

                         driver1.get("https://www.facebook.com/");

                         

                        }catch(Exception e)

                        {

                                   

                        }

            }

 

}

 

Thanks in Advance !

 

Regards,

Poovaraj

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAMu9-ZW2Kn7u5oFmdPdzRG5G1heF5m%2BeUtMSCB8OkkMZXiiZiw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/D10D3CA6-10AF-46C7-ABEF-DB8890E4D8BD%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAMu9-ZXohDu3fn2fZ%2B6SUpq54NKU7qcd7wZqUYgrW6exvYMK%3Dg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to clone Selenium Webdriver using Java language ? Is it Possible or not ?

Krishnan Mahadevan

Why not just work with two WebDriver instances ? Wouldn't that be a lot more simpler and easier to manage rather than resorting to clone ?

Your test case would just create two WebDriver instances wherein, in the first instance you would have opened your web application #1 and in the second instance you would have opened the second web application.

You don't need clone here. You just need your test to create and work with two WebDriver instances rather than one (which is what most tests would usually work with ).


On Sat, May 27, 2017, 21:34 Poovaraj Thangamariappan <[hidden email]> wrote:
Hi Krishnan Mahadevan,

Thanks for your reply.  I have to validate 2 application simultaneously using single driver.  

Scenarios :-

  • Login into application and Updated in Email ID in first application
  • I have to open second application and verify email id is updated or not
  • Again, I have to move first application and updated in account number
  • verify account number in second application 


* I cannot use SwitchToWindow and SwitchToFrame option in this scenarios 
  
  How to handle this scenario without using 2 webdriver instance ? 


Regards,
Poovaraj

On Sat, May 27, 2017 at 10:08 AM, Krishnan Mahadevan <[hidden email]> wrote:

Can you please help elaborate your use case ? What exactly are you trying to do ?

 

Your cloning mechanism wont work, because you have merely invoked a super.clone() (here your super is basically the Cloneable interface and it doesn’t have any implementation).

You would need to write code such that the clone() implementation creates another WebDriver instance and returns it optionally doing the following :

 

  • Open the same URL as the original instance
  • Copy the cookies if applicable/relevant
  • Duplicate the window size etc.,

 

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

 

From: <[hidden email]> on behalf of Poovaraj Thangamariappan <[hidden email]>
Reply-To: <[hidden email]>
Date: Saturday, May 27, 2017 at 9:58 AM
To: <[hidden email]>
Subject: [selenium-users] How to clone Selenium Webdriver using Java language ? Is it Possible or not ?

 

Hi Team,

 

I want to clone Selenium Webdriver using Java language. I have written below code. Can you please help me how to clone webdriver ?  Is it possible or not ? Please correct me if it is wrong ?

 

Code :-

 

package Selenium_Program;

 

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.chrome.ChromeDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

 

public class demo_WebDriver_Cloning implements Cloneable

{

            public static WebDriver driver;

            public static WebDriver driver1;

 

            demo_WebDriver_Cloning(WebDriver driver)

            {

                        this.driver=driver;

            }

           

            @Override

            public Object clone() throws CloneNotSupportedException

            {

                        return (demo_WebDriver_Cloning)super.clone();

            }

           

            public static void main(String[] args)

            {

                       

                        try

                        {                                 

                       

                        // TODO Auto-generated method stub

                         demo_WebDriver_Cloning obj = new demo_WebDriver_Cloning(driver);                                    

                         System.setProperty("webdriver.gecko.driver", "D:\\Working\\Selenium\\geckodriver.exe");

                         driver=new FirefoxDriver(); 

                         driver.get("https://www.google.co.in/");                     

                                   

                         

                         driver1 = (demo_WebDriver_Cloning)driver.clone();

                         driver1.get("https://www.facebook.com/");

                         

                        }catch(Exception e)

                        {

                                   

                        }

            }

 

}

 

Thanks in Advance !

 

Regards,

Poovaraj

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAMu9-ZW2Kn7u5oFmdPdzRG5G1heF5m%2BeUtMSCB8OkkMZXiiZiw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAMu9-ZXohDu3fn2fZ%2B6SUpq54NKU7qcd7wZqUYgrW6exvYMK%3Dg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CANikZLmor%2BCH1AxGikVnhU9%3Dz6Ka0DFy0OU7Uhpbg12_k7hQqA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to clone Selenium Webdriver using Java language ? Is it Possible or not ?

Poovaraj Thangamariappan

It was working fine this scenario if i have created 2 web driver instance but Currently, the Framework is not supporting to create 2 webdriver instance simultaneously. so, I have cloned web driver instance.  

Is anyother way to achieve this scenario using single webdriver instance ? 


On Sat, May 27, 2017 at 9:38 PM, ⇜Krishnan Mahadevan⇝ <[hidden email]> wrote:

Why not just work with two WebDriver instances ? Wouldn't that be a lot more simpler and easier to manage rather than resorting to clone ?

Your test case would just create two WebDriver instances wherein, in the first instance you would have opened your web application #1 and in the second instance you would have opened the second web application.

You don't need clone here. You just need your test to create and work with two WebDriver instances rather than one (which is what most tests would usually work with ).


On Sat, May 27, 2017, 21:34 Poovaraj Thangamariappan <[hidden email]> wrote:
Hi Krishnan Mahadevan,

Thanks for your reply.  I have to validate 2 application simultaneously using single driver.  

Scenarios :-

  • Login into application and Updated in Email ID in first application
  • I have to open second application and verify email id is updated or not
  • Again, I have to move first application and updated in account number
  • verify account number in second application 


* I cannot use SwitchToWindow and SwitchToFrame option in this scenarios 
  
  How to handle this scenario without using 2 webdriver instance ? 


Regards,
Poovaraj

On Sat, May 27, 2017 at 10:08 AM, Krishnan Mahadevan <[hidden email]> wrote:

Can you please help elaborate your use case ? What exactly are you trying to do ?

 

Your cloning mechanism wont work, because you have merely invoked a super.clone() (here your super is basically the Cloneable interface and it doesn’t have any implementation).

You would need to write code such that the clone() implementation creates another WebDriver instance and returns it optionally doing the following :

 

  • Open the same URL as the original instance
  • Copy the cookies if applicable/relevant
  • Duplicate the window size etc.,

 

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

 

From: <[hidden email]> on behalf of Poovaraj Thangamariappan <[hidden email]>
Reply-To: <[hidden email]>
Date: Saturday, May 27, 2017 at 9:58 AM
To: <[hidden email]>
Subject: [selenium-users] How to clone Selenium Webdriver using Java language ? Is it Possible or not ?

 

Hi Team,

 

I want to clone Selenium Webdriver using Java language. I have written below code. Can you please help me how to clone webdriver ?  Is it possible or not ? Please correct me if it is wrong ?

 

Code :-

 

package Selenium_Program;

 

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.chrome.ChromeDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

 

public class demo_WebDriver_Cloning implements Cloneable

{

            public static WebDriver driver;

            public static WebDriver driver1;

 

            demo_WebDriver_Cloning(WebDriver driver)

            {

                        this.driver=driver;

            }

           

            @Override

            public Object clone() throws CloneNotSupportedException

            {

                        return (demo_WebDriver_Cloning)super.clone();

            }

           

            public static void main(String[] args)

            {

                       

                        try

                        {                                 

                       

                        // TODO Auto-generated method stub

                         demo_WebDriver_Cloning obj = new demo_WebDriver_Cloning(driver);                                    

                         System.setProperty("webdriver.gecko.driver", "D:\\Working\\Selenium\\geckodriver.exe");

                         driver=new FirefoxDriver(); 

                         driver.get("https://www.google.co.in/");                     

                                   

                         

                         driver1 = (demo_WebDriver_Cloning)driver.clone();

                         driver1.get("https://www.facebook.com/");

                         

                        }catch(Exception e)

                        {

                                   

                        }

            }

 

}

 

Thanks in Advance !

 

Regards,

Poovaraj

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAMu9-ZW2Kn7u5oFmdPdzRG5G1heF5m%2BeUtMSCB8OkkMZXiiZiw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAMu9-ZXohDu3fn2fZ%2B6SUpq54NKU7qcd7wZqUYgrW6exvYMK%3Dg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CANikZLmor%2BCH1AxGikVnhU9%3Dz6Ka0DFy0OU7Uhpbg12_k7hQqA%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAMu9-ZUf%2BRboQVWQ6b8sHCqk0Y%3DW8iKtKrJTZJUK4Lu9Ni0WHw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to clone Selenium Webdriver using Java language ? Is it Possible or not ?

Krishnan Mahadevan

Even then you can have one WebDriver managed by your framework and the other one managed by your test case no ? You can extend the concept of cloning but not in the literal sense but by having your test introspect the WebDriver instance provided by your framework, take a look at it's capabilities and then create a "similar" webdriver instance which your test can manage.

At the end, before your test runs to completion it can clean up the WebDriver instance it created.

The other option would be to inject a hyperlink in runtime using JavaScript via your webdriver. This hyper link when clicked would trigger a new window to be opened. From there on your test can merely switch to the other window and have it open up a new url ( your second web app ) and take it up from there.


On Sat, May 27, 2017, 21:53 Poovaraj Thangamariappan <[hidden email]> wrote:

It was working fine this scenario if i have created 2 web driver instance but Currently, the Framework is not supporting to create 2 webdriver instance simultaneously. so, I have cloned web driver instance.  

Is anyother way to achieve this scenario using single webdriver instance ? 


On Sat, May 27, 2017 at 9:38 PM, ⇜Krishnan Mahadevan⇝ <[hidden email]> wrote:

Why not just work with two WebDriver instances ? Wouldn't that be a lot more simpler and easier to manage rather than resorting to clone ?

Your test case would just create two WebDriver instances wherein, in the first instance you would have opened your web application #1 and in the second instance you would have opened the second web application.

You don't need clone here. You just need your test to create and work with two WebDriver instances rather than one (which is what most tests would usually work with ).


On Sat, May 27, 2017, 21:34 Poovaraj Thangamariappan <[hidden email]> wrote:
Hi Krishnan Mahadevan,

Thanks for your reply.  I have to validate 2 application simultaneously using single driver.  

Scenarios :-

  • Login into application and Updated in Email ID in first application
  • I have to open second application and verify email id is updated or not
  • Again, I have to move first application and updated in account number
  • verify account number in second application 


* I cannot use SwitchToWindow and SwitchToFrame option in this scenarios 
  
  How to handle this scenario without using 2 webdriver instance ? 


Regards,
Poovaraj

On Sat, May 27, 2017 at 10:08 AM, Krishnan Mahadevan <[hidden email]> wrote:

Can you please help elaborate your use case ? What exactly are you trying to do ?

 

Your cloning mechanism wont work, because you have merely invoked a super.clone() (here your super is basically the Cloneable interface and it doesn’t have any implementation).

You would need to write code such that the clone() implementation creates another WebDriver instance and returns it optionally doing the following :

 

  • Open the same URL as the original instance
  • Copy the cookies if applicable/relevant
  • Duplicate the window size etc.,

 

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

 

From: <[hidden email]> on behalf of Poovaraj Thangamariappan <[hidden email]>
Reply-To: <[hidden email]>
Date: Saturday, May 27, 2017 at 9:58 AM
To: <[hidden email]>
Subject: [selenium-users] How to clone Selenium Webdriver using Java language ? Is it Possible or not ?

 

Hi Team,

 

I want to clone Selenium Webdriver using Java language. I have written below code. Can you please help me how to clone webdriver ?  Is it possible or not ? Please correct me if it is wrong ?

 

Code :-

 

package Selenium_Program;

 

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.chrome.ChromeDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

 

public class demo_WebDriver_Cloning implements Cloneable

{

            public static WebDriver driver;

            public static WebDriver driver1;

 

            demo_WebDriver_Cloning(WebDriver driver)

            {

                        this.driver=driver;

            }

           

            @Override

            public Object clone() throws CloneNotSupportedException

            {

                        return (demo_WebDriver_Cloning)super.clone();

            }

           

            public static void main(String[] args)

            {

                       

                        try

                        {                                 

                       

                        // TODO Auto-generated method stub

                         demo_WebDriver_Cloning obj = new demo_WebDriver_Cloning(driver);                                    

                         System.setProperty("webdriver.gecko.driver", "D:\\Working\\Selenium\\geckodriver.exe");

                         driver=new FirefoxDriver(); 

                         driver.get("https://www.google.co.in/");                     

                                   

                         

                         driver1 = (demo_WebDriver_Cloning)driver.clone();

                         driver1.get("https://www.facebook.com/");

                         

                        }catch(Exception e)

                        {

                                   

                        }

            }

 

}

 

Thanks in Advance !

 

Regards,

Poovaraj

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAMu9-ZW2Kn7u5oFmdPdzRG5G1heF5m%2BeUtMSCB8OkkMZXiiZiw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAMu9-ZXohDu3fn2fZ%2B6SUpq54NKU7qcd7wZqUYgrW6exvYMK%3Dg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAMu9-ZUf%2BRboQVWQ6b8sHCqk0Y%3DW8iKtKrJTZJUK4Lu9Ni0WHw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CANikZL%3Dq7s8PoEAXacJf4CRCcocb5fR0f7awP_RKv3itGBaBFw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to clone Selenium Webdriver using Java language ? Is it Possible or not ?

Poovaraj Thangamariappan

Thank you. Let me try this option !


On Sat, May 27, 2017 at 9:58 PM, ⇜Krishnan Mahadevan⇝ <[hidden email]> wrote:

Even then you can have one WebDriver managed by your framework and the other one managed by your test case no ? You can extend the concept of cloning but not in the literal sense but by having your test introspect the WebDriver instance provided by your framework, take a look at it's capabilities and then create a "similar" webdriver instance which your test can manage.

At the end, before your test runs to completion it can clean up the WebDriver instance it created.

The other option would be to inject a hyperlink in runtime using JavaScript via your webdriver. This hyper link when clicked would trigger a new window to be opened. From there on your test can merely switch to the other window and have it open up a new url ( your second web app ) and take it up from there.


On Sat, May 27, 2017, 21:53 Poovaraj Thangamariappan <[hidden email]> wrote:

It was working fine this scenario if i have created 2 web driver instance but Currently, the Framework is not supporting to create 2 webdriver instance simultaneously. so, I have cloned web driver instance.  

Is anyother way to achieve this scenario using single webdriver instance ? 


On Sat, May 27, 2017 at 9:38 PM, ⇜Krishnan Mahadevan⇝ <[hidden email]> wrote:

Why not just work with two WebDriver instances ? Wouldn't that be a lot more simpler and easier to manage rather than resorting to clone ?

Your test case would just create two WebDriver instances wherein, in the first instance you would have opened your web application #1 and in the second instance you would have opened the second web application.

You don't need clone here. You just need your test to create and work with two WebDriver instances rather than one (which is what most tests would usually work with ).


On Sat, May 27, 2017, 21:34 Poovaraj Thangamariappan <[hidden email]> wrote:
Hi Krishnan Mahadevan,

Thanks for your reply.  I have to validate 2 application simultaneously using single driver.  

Scenarios :-

  • Login into application and Updated in Email ID in first application
  • I have to open second application and verify email id is updated or not
  • Again, I have to move first application and updated in account number
  • verify account number in second application 


* I cannot use SwitchToWindow and SwitchToFrame option in this scenarios 
  
  How to handle this scenario without using 2 webdriver instance ? 


Regards,
Poovaraj

On Sat, May 27, 2017 at 10:08 AM, Krishnan Mahadevan <[hidden email]> wrote:

Can you please help elaborate your use case ? What exactly are you trying to do ?

 

Your cloning mechanism wont work, because you have merely invoked a super.clone() (here your super is basically the Cloneable interface and it doesn’t have any implementation).

You would need to write code such that the clone() implementation creates another WebDriver instance and returns it optionally doing the following :

 

  • Open the same URL as the original instance
  • Copy the cookies if applicable/relevant
  • Duplicate the window size etc.,

 

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

 

From: <[hidden email]> on behalf of Poovaraj Thangamariappan <[hidden email]>
Reply-To: <[hidden email]>
Date: Saturday, May 27, 2017 at 9:58 AM
To: <[hidden email]>
Subject: [selenium-users] How to clone Selenium Webdriver using Java language ? Is it Possible or not ?

 

Hi Team,

 

I want to clone Selenium Webdriver using Java language. I have written below code. Can you please help me how to clone webdriver ?  Is it possible or not ? Please correct me if it is wrong ?

 

Code :-

 

package Selenium_Program;

 

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.chrome.ChromeDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

 

public class demo_WebDriver_Cloning implements Cloneable

{

            public static WebDriver driver;

            public static WebDriver driver1;

 

            demo_WebDriver_Cloning(WebDriver driver)

            {

                        this.driver=driver;

            }

           

            @Override

            public Object clone() throws CloneNotSupportedException

            {

                        return (demo_WebDriver_Cloning)super.clone();

            }

           

            public static void main(String[] args)

            {

                       

                        try

                        {                                 

                       

                        // TODO Auto-generated method stub

                         demo_WebDriver_Cloning obj = new demo_WebDriver_Cloning(driver);                                    

                         System.setProperty("webdriver.gecko.driver", "D:\\Working\\Selenium\\geckodriver.exe");

                         driver=new FirefoxDriver(); 

                         driver.get("https://www.google.co.in/");                     

                                   

                         

                         driver1 = (demo_WebDriver_Cloning)driver.clone();

                         driver1.get("https://www.facebook.com/");

                         

                        }catch(Exception e)

                        {

                                   

                        }

            }

 

}

 

Thanks in Advance !

 

Regards,

Poovaraj

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAMu9-ZW2Kn7u5oFmdPdzRG5G1heF5m%2BeUtMSCB8OkkMZXiiZiw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAMu9-ZXohDu3fn2fZ%2B6SUpq54NKU7qcd7wZqUYgrW6exvYMK%3Dg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAMu9-ZUf%2BRboQVWQ6b8sHCqk0Y%3DW8iKtKrJTZJUK4Lu9Ni0WHw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CANikZL%3Dq7s8PoEAXacJf4CRCcocb5fR0f7awP_RKv3itGBaBFw%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAMu9-ZWzDOOrUVDD7CPejo%2B98QMv-gcAow3Cc_MaaKBhu8z3Lg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Loading...