简体   繁体   English

硒警报盒Java

[英]Selenium Alert Box Java

I have a more general question without source examples. 我有一个更普遍的问题,没有源示例。

I have - until now - three Selenium/Java tasks running with Jenkins. 到目前为止,我已经使用Jenkins运行了三个Selenium / Java任务。 All of them have alert boxes which handeld usually correct. 它们都具有警报框,通常可以正确处理。 But sometimes, I get the error, what the expected text not appeared or that the alert box doesn't exist. 但是有时候,我得到了错误,没有出现预期的文本,或者警报框不存在。 The alert text in the different Selenium/Java tasks is the same! 不同的Selenium / Java任务中的警报文本是相同的!

Is it possible, I can't look the whole time on the screen, what sometimes the alert box of - for example Selenium/Java task 1 - closes also the alert box of an other Selenium/Java task 2 or 3, which appears at the same time? 是否有可能,我看不到整个屏幕,有时警报框(例如Selenium / Java任务1)有时也会关闭另一个Selenium / Java任务2或3的警报框,该对话框显示在同一时间?

If so - how can I make sure, that only the right one is closed? 如果是这样-我如何确保只关闭正确的一个?

1) If you run your tests at the same time (parallel) you have to use threads, then webdriver will close the right one AlertBox ( link or link ) 1)如果必须同时(并行)运行测试,则必须使用线程,然后webdriver将关闭正确的一个AlertBox( linklink

2) If you run your tests not at the same time you can do screenshot ( link ) and copy innerHTML of whole page in selenium driver ( link ) when something goes wrong and analyze what exactly happened in that case. 2)如果您不同时运行测试,则可以进行屏幕截图( 链接 ),并在出现问题时将整个页面的innerHTML复制到selenium驱动程序中( 链接 ),并分析在这种情况下到底发生了什么。 You of course can do screenshot and copy innerHTML of whole page when you run your tests parallel. 当您并行运行测试时,您当然可以截图并复制整个页面的innerHTML。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM