[rc] Not choose Ok in pop-up message

37 views
Skip to first unread message

Jailton Jr

unread,
Sep 10, 2010, 4:47:05 PM9/10/10
to Selenium Users
Hey everybody!

Anyone can help me, I already tryed a lot of things and nothing
working here... I using Selenium RC, TestNG and JAVA in my tests.

I have the folow scenario:

1 - One method of login in my aplication using @BeforeTest anotation:

@BeforeTest()
public void login() {
selenium.open("the url goes here...");
selenium.type("username", "admin");
selenium.type("password", "admin");
selenium.type("captcha", "admin");
selenium.click("//input[@value='Login']");
selenium.waitForPageToLoad("3000");


}

2 - And a testcase wich use to do something in my system, but before
it need loged in my system, until here everything happens well, but
when I will confirmate the message of include data in my system the
Selenium can't find the button confirmation.

@Test(dataProvider = "MassaDeDados", dataProviderClass =
TemplateDataProvider.class)
public void InclusaoTipoDocumento (ArrayList<String> valor)
{

for (int i = 0; i < valor.size(); i++) {

selenium.click("link-0");
selenium.click("link-1");
selenium.waitForPageToLoad("3000");
selenium.click("//input[@value='Incluir']");
selenium.waitForPageToLoad("3000");
selenium.type("comptipoDocumentodscTipoDocumento", valor.get(i));
selenium.click("incluir_botao_salvar");
selenium.chooseOkOnNextConfirmation();

}
}

It's very strange because two reasons:

1 - In my application the erro happens like Selenium can't find the
button OK to confirmation, look the error exception:

FAILED: InclusaoTipoDocumento([nothingxzghawtqweqwwreq, maria9, joão9,
mixirica9, bahia9, Lorem9, ipsum9, dolor9, sit9, amet9, consectetur9,
adipiscing9, elit9, Curabitur9, odio9, orci9, imperdiet9, non9,
posuere9, vel9, eleifend9, ut9, magna9, Integer9, blandit9, iaculis9,
augue9, ])
Inclusao de Tipo de Documento
com.thoughtworks.selenium.SeleniumException: Timed out after 3000ms
at
com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:
97)
at
com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:
91)
at
com.thoughtworks.selenium.DefaultSelenium.waitForPageToLoad(DefaultSelenium.java:
635)
at br.com.politec.testCases.CDU001.InclusaoTipoDocumento(CDU001.java:
45)

2 - But when I look the log file generate by Selenium-RC it's like
this:

* info(1284150721133): Appending missed logging messages
* info(1284150698036): Executing: |getTitle | | |
* info(1284150698050): Executing: |setContext |
d2e072fce7354f378d13be19615152db | |
* info(1284150698072): Executing: |windowMaximize | | |
* info(1284150698077): Executing: |windowFocus | | |
* info(1284150698088): Executing: |open | url goes here | |
* info(1284150698356): Executing: |type | username | admin |
* info(1284150698367): Executing: |type | password | admin |
* info(1284150698378): Executing: |type | captcha | admin |
* info(1284150698388): Executing: |click | //input[@value='Login']
| |
* info(1284150698458): Executing: |waitForPageToLoad | 3000 | |
* info(1284150699840): Executing: |click | link-0 | |
* info(1284150699881): Executing: |click | link-1 | |
* info(1284150699912): Executing: |waitForPageToLoad | 3000 | |
* info(1284150700259): Executing: |click | //
input[@value='Incluir'] | |
* info(1284150700285): Executing: |waitForPageToLoad | 3000 | |
* info(1284150700508): Executing: |type |
comptipoDocumentodscTipoDocumento | nothingxzghawtqweqwwreq |
* info(1284150700519): Executing: |click | incluir_botao_salvar |
|
* info(1284150700676): Executing: |chooseOkOnNextConfirmation | |
|
* info(1284150700682): Executing: |click | link-0 | |
* info(1284150700722): Executing: |click | link-1 | |
* info(1284150700756): Executing: |waitForPageToLoad | 3000 | |
* info(1284150703783): Executing: |captureEntirePageScreenshot | C:
\des\workspace\TestesAutomatizadosPolitec\Evidencias
\InclusaoTipoDocumento_2010-09-10_17-31-43.png | |
* info(1284150703904): Executing: |selectWindow | | |
* info(1284150703919): Executing: |open | http://10.62.1.37:7080 |
|
* info(1284150721139): Done appending missed logging messages
* error(1284150721140): Log window displayed. Logging events will
now be recorded to this window.


Anyone can help me?? Thnks!

Elias Nogueira

unread,
Sep 11, 2010, 10:50:58 PM9/11/10
to seleniu...@googlegroups.com
Your timeout is about 3 seconds... try to add more time in your timeout...
It's the fist thing that I see in your script...

The default Selenium timeout is about 30 seconds (30000 milliseconds)

Best regards!
--
Elias Nogueira, CSTE
elias.n...@gmail.com

CSTE - Certified Software Tester
Blog: http://sembugs.blogspot.com
Twitter: http://twitter.com/eliasnogueira
LinkedIn: http://www.linkedin.com/in/eliasnogueira





--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.


Niraj Kumar

unread,
Sep 12, 2010, 2:47:42 AM9/12/10
to seleniu...@googlegroups.com
Try below method to solve this
 

   selenium.chooseCancelOnNextConfirmation();

   // click|confirmAndLeave|
   selenium.click("confirm");
   // verifyConfirmationPresent
   assertTrue(selenium.isConfirmationPresent());
   boolean bool = false;
   for (int second = 0; second < 120; second++) {
    try {
     if ((selenium.isConfirmationPresent())) {
      boll = true;
      break;
     }
    }
    catch (Exception ignore) {
    }
    pause(1000);
   }
   assertTrue(bool);

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.




--
Thanks & Regard,
Niraj Kumar

shw

unread,
Sep 20, 2010, 11:40:37 PM9/20/10
to Selenium Users
Here is one suggestion,
Try with get confirmation matches() this will help to ensure the
confirmation message and to click OK on it ,but due to a bug in
selenium you cannt see the confirmation message on your window.

On Sep 12, 11:47 am, Niraj Kumar <bewith.ni...@gmail.com> wrote:
> Try below method to solve this
>
>    selenium.chooseCancelOnNextConfirmation();
>
>    // click|confirmAndLeave|
>    selenium.click("confirm");
>    // verifyConfirmationPresent
>    assertTrue(selenium.isConfirmationPresent());
>    boolean bool = false;
>    for (int second = 0; second < 120; second++) {
>     try {
>      if ((selenium.isConfirmationPresent())) {
>       boll = true;
>       break;
>      }
>     }
>     catch (Exception ignore) {
>     }
>     pause(1000);
>    }
>    assertTrue(bool);
>
> > selenium-user...@googlegroups.com<selenium-users%2Bunsubscribe@go oglegroups.com>
> > .
Reply all
Reply to author
Forward
0 new messages