Skip to main content
deleted 49 characters in body
Source Link
First I am not a tester, I am a developer;
First I am not a tester, I am a developer;

Hahaha,
First i am not a tester, i am a developer;


First I am not a tester, I am a developer;
iI
writtingwriting
iI
logginlog-in
logginlog-in
iI
iI
iI

The key is the second program,
the second program need use the class RemoteWebDriver. beausebecause the the first program open a with webserver's browser, but the official api have not offer the api reopen the exist browser. after i read source, i decide overwrite the RemoteWebDriver, because over the extends RemoteWebDriver i can't modify the capabilities field, so i overwrite it, but another way use the reflect you can have a try, this class newInstance main work is startClient and startSession, the method startClient keep it well, we need change the method startSession modify the nested execute Command and add the with cookie-string's construct method.

The RemoteWebDriver is too long. the textareatext-area has letter limit, the underside is link https://github.com/chekn/source-ex-ref/blob/master/RemoteWebDriver.java


1、
Get the RemotWebDriver class from upper link, instand the official

2、
open a browser

1. Get the RemoteWebDriver class from upper link, instand the official

2. Open a browser

    FirefoxDriver driver = new FirefoxDriver();

    LazyCommandExecutor ce = (LazyCommandExecutor) driver.getCommandExecutor();
    String svr= ce.getAddressOfRemoteServer().toString();
    System.out.println( "svr: " + svr);

    String sid = driver.getSessionId().toString();
    System.out.println("sid: " + sid );
    TimeUnit.MINUTES.sleep(10L);

Important Tips:
Please terminate program of this step launch in 10s (depend the TimeUnit sleep setter value), i find when i let it run finish, the third step execute command will fail that appear no reponse exception. i donot know Why, i think maybe program finished normal, the thread send the other order block the server api, only for the right request(right url and right params), if use wrong request it reponse, how Odd! I donot like go back view. So if you know the reason and you have different discovery, welcome back tell me.

3、reuse the browser, use the up step printed host and cookie


Important Tips:<br>
Please terminate program of this step launch in 10s (depend the TimeUnit sleep setter value), i find when i let it run finish, the third step execute command will fail that appear no reponse exception. i donot know Why, i think maybe program finished normal, the thread send the other order block the server api, only for the right request(right url and right params), if use wrong request it reponse, how Odd! I donot like go back view. So if you know the reason and you have different discovery, welcome back tell me.

3.Reuse the browser, use the up step printed host and cookie

    DesiredCapabilities capabilities = DesiredCapabilities.firefox();
    RemoteWebDriver driver = new RemoteWebDriver(new URL("http://127.0.0.1:7055/hub"), "41ad3bed-53af-4fdf-a2d1-f3f428e7d071", capabilities);
    

Hahaha,
First i am not a tester, i am a developer;

i
writting
i
loggin
loggin
i
i
i

The key is the second program,
the second program need use the class RemoteWebDriver. beause the the first program open a with webserver's browser, but the official api have not offer the api reopen the exist browser. after i read source, i decide overwrite the RemoteWebDriver, because over the extends RemoteWebDriver i can't modify the capabilities field, so i overwrite it, but another way use the reflect you can have a try, this class newInstance main work is startClient and startSession, the method startClient keep it well, we need change the method startSession modify the nested execute Command and add the with cookie-string's construct method.

The RemoteWebDriver is too long. the textarea has letter limit, the underside is link https://github.com/chekn/source-ex-ref/blob/master/RemoteWebDriver.java


1、
Get the RemotWebDriver class from upper link, instand the official

2、
open a browser

FirefoxDriver driver = new FirefoxDriver();

LazyCommandExecutor ce = (LazyCommandExecutor) driver.getCommandExecutor();
String svr= ce.getAddressOfRemoteServer().toString();
System.out.println( "svr: " + svr);

String sid = driver.getSessionId().toString();
System.out.println("sid: " + sid );
TimeUnit.MINUTES.sleep(10L);

Important Tips:
Please terminate program of this step launch in 10s (depend the TimeUnit sleep setter value), i find when i let it run finish, the third step execute command will fail that appear no reponse exception. i donot know Why, i think maybe program finished normal, the thread send the other order block the server api, only for the right request(right url and right params), if use wrong request it reponse, how Odd! I donot like go back view. So if you know the reason and you have different discovery, welcome back tell me.

3、reuse the browser, use the up step printed host and cookie

DesiredCapabilities capabilities = DesiredCapabilities.firefox();
RemoteWebDriver driver = new RemoteWebDriver(new URL("http://127.0.0.1:7055/hub"), "41ad3bed-53af-4fdf-a2d1-f3f428e7d071", capabilities);

First I am not a tester, I am a developer;
I
writing
I
log-in
log-in
I
I
I

The key is the second program,
the second program need use the class RemoteWebDriver. because the the first program open a with webserver's browser, but the official api have not offer the api reopen the exist browser. after i read source, i decide overwrite the RemoteWebDriver, because over the extends RemoteWebDriver i can't modify the capabilities field, so i overwrite it, but another way use the reflect you can have a try, this class newInstance main work is startClient and startSession, the method startClient keep it well, we need change the method startSession modify the nested execute Command and add the with cookie-string's construct method.

The RemoteWebDriver is too long. the text-area has letter limit, the underside is link https://github.com/chekn/source-ex-ref/blob/master/RemoteWebDriver.java

1. Get the RemoteWebDriver class from upper link, instand the official

2. Open a browser

    FirefoxDriver driver = new FirefoxDriver();

    LazyCommandExecutor ce = (LazyCommandExecutor) driver.getCommandExecutor();
    String svr= ce.getAddressOfRemoteServer().toString();
    System.out.println( "svr: " + svr);

    String sid = driver.getSessionId().toString();
    System.out.println("sid: " + sid );
    TimeUnit.MINUTES.sleep(10L);

Important Tips:<br>
Please terminate program of this step launch in 10s (depend the TimeUnit sleep setter value), i find when i let it run finish, the third step execute command will fail that appear no reponse exception. i donot know Why, i think maybe program finished normal, the thread send the other order block the server api, only for the right request(right url and right params), if use wrong request it reponse, how Odd! I donot like go back view. So if you know the reason and you have different discovery, welcome back tell me.

3.Reuse the browser, use the up step printed host and cookie

    DesiredCapabilities capabilities = DesiredCapabilities.firefox();
    RemoteWebDriver driver = new RemoteWebDriver(new URL("http://127.0.0.1:7055/hub"), "41ad3bed-53af-4fdf-a2d1-f3f428e7d071", capabilities);
    
Source Link

Hahaha,
First i am not a tester, i am a developer;


When i experience this question, i am writting my automatic-answer, i hope it can control one had exist browser where the ready work is finish, the ready work such as loggin expend very long times then loggin fail by selenium, our country some big company's sites just like this. i seek the info through on the net, contain this page, but not find works. i have to solve this question by myself, finally i get the way.
Of course, the ideas is get the server and the cookie from first program. after. we set the info to second program.

The key is the second program,
the second program need use the class RemoteWebDriver. beause the the first program open a with webserver's browser, but the official api have not offer the api reopen the exist browser. after i read source, i decide overwrite the RemoteWebDriver, because over the extends RemoteWebDriver i can't modify the capabilities field, so i overwrite it, but another way use the reflect you can have a try, this class newInstance main work is startClient and startSession, the method startClient keep it well, we need change the method startSession modify the nested execute Command and add the with cookie-string's construct method.

The RemoteWebDriver is too long. the textarea has letter limit, the underside is link https://github.com/chekn/source-ex-ref/blob/master/RemoteWebDriver.java


You can use like this
1、
Get the RemotWebDriver class from upper link, instand the official

2、
open a browser

FirefoxDriver driver = new FirefoxDriver();

LazyCommandExecutor ce = (LazyCommandExecutor) driver.getCommandExecutor();
String svr= ce.getAddressOfRemoteServer().toString();
System.out.println( "svr: " + svr);

String sid = driver.getSessionId().toString();
System.out.println("sid: " + sid );
TimeUnit.MINUTES.sleep(10L);

Important Tips:
Please terminate program of this step launch in 10s (depend the TimeUnit sleep setter value), i find when i let it run finish, the third step execute command will fail that appear no reponse exception. i donot know Why, i think maybe program finished normal, the thread send the other order block the server api, only for the right request(right url and right params), if use wrong request it reponse, how Odd! I donot like go back view. So if you know the reason and you have different discovery, welcome back tell me.

3、reuse the browser, use the up step printed host and cookie

DesiredCapabilities capabilities = DesiredCapabilities.firefox();
RemoteWebDriver driver = new RemoteWebDriver(new URL("http://127.0.0.1:7055/hub"), "41ad3bed-53af-4fdf-a2d1-f3f428e7d071", capabilities);

Now you can use the browser.