run script on safari

578 views
Skip to first unread message

Priyanka khattar

unread,
Mar 7, 2013, 7:13:33 AM3/7/13
to webd...@googlegroups.com

Please Help me on this..

My script won't run on safari but working fine on FF, Chrome & IE.There is no alert in my website but still giving below issue.

Exception in thread "main" org.openqa.selenium.UnhandledAlertException: A modal dialog was opened. The SafariDriver does not support interacting with modal dialogs. To avoid hanging your test, the alert has been dismissed. For more information, see http://code.google.com/p/selenium/issues/detail?id=3862
Build info: version: '2.31.0', revision: '1bd294d', time: '2013-02-27 20:52:59'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_05'
Session ID: null
Driver info: org.openqa.selenium.safari.SafariDriver
Capabilities [{platform=WINDOWS, javascriptEnabled=true, cssSelectorsEnabled=true, secureSsl=true, browserName=safari, takesScreenshot=true, version=5.1.2}]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:187)
    at org.openqa.selenium.remote.ErrorHandler.createUnhandledAlertException(ErrorHandler.java:168)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:141)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
    at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:268)
    at org.openqa.selenium.remote.RemoteWebElement.sendKeys(RemoteWebElement.java:89)
    at code.Test1.carInfo(Test1.java:60)
    at code.Test1.main(Test1.java:25)
Mar 07, 2013 5:36:17 PM org.jboss.netty.channel.SimpleChannelUpstreamHandler
WARNING: EXCEPTION, please implement org.openqa.selenium.safari.SafariDriverChannelHandler.exceptionCaught() for proper handling.
java.io.IOException: An existing connection was forcibly closed by the remote host
    at sun.nio.ch.SocketDispatcher.read0(Native Method)
    at sun.nio.ch.SocketDispatcher.read(Unknown Source)
    at sun.nio.ch.IOUtil.readIntoNativeBuffer(Unknown Source)
    at sun.nio.ch.IOUtil.read(Unknown Source)
    at sun.nio.ch.SocketChannelImpl.read(Unknown Source)
    at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:59)
    at org.jboss.netty.channel.socket.nio.AbstractNioWorker.processSelectedKeys(AbstractNioWorker.java:465)
    at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:332)
    at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:35)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)


Krishnan Mahadevan

unread,
Mar 7, 2013, 10:32:09 AM3/7/13
to webd...@googlegroups.com
Priyanka,

The exception that you triggered seems to have a lot of information.

Can you please try going through the comments section of  : https://code.google.com/p/selenium/issues/detail?id=3862

and see if any of that helps ?

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/





--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webdriver+...@googlegroups.com.
To post to this group, send email to webd...@googlegroups.com.
Visit this group at http://groups.google.com/group/webdriver?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

darrell

unread,
Mar 7, 2013, 1:15:22 PM3/7/13
to webdriver
SafariDriver has some known limitations. Handling alerts is one of
them. On other browsers, you can write code to create an Alert object,
catch the alert a browser is throwing and give a response. For
example:

Alert a = driver.switchTo().alert();
a.dismiss(); // click the cancel button

You could also do a.accept() if you want to simulate clicking the OK
button. With the SafariDriver this will throw an exception and
automatically dismiss the alert. You can wrap the code in a try/catch
statement and handle the exception. If you want to simulate clicking
the OK button it gets a lot harder. As Krishnan has mentioned. Read
the bug reports, understand what they are saying and figure out how
you can solve the problem for your particular case. The people
maintaining the SafariDriver code have said it will not be fixed.

Darrell

On Mar 7, 7:13 am, Priyanka khattar <priyanka.khatte...@gmail.com>
wrote:
> Please Help me on this..
>
> My script won't run on safari but working fine on FF, Chrome & IE.There is
> no alert in my website but still giving below issue.
>
> Exception in thread "main" org.openqa.selenium.UnhandledAlertException: A
> modal dialog was opened. The SafariDriver does not support interacting with
> modal dialogs. To avoid hanging your test, the alert has been dismissed.
> For more information, seehttp://code.google.com/p/selenium/issues/detail?id=3862
> org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker. java:332)

Priyanka khattar

unread,
Mar 11, 2013, 9:12:02 AM3/11/13
to webd...@googlegroups.com

Hi krishna & Darell,

In app, when script move to next element(text box) form selecting value in drop down.then it does not write any thing in text box but focus is there. and an
UnhandledAlertException thrown for modal dialog box.but there is no dialog box..

I used this..


Alert a = driver.switchTo().alert();
    a.dismiss();
and also add safriextension certificate..
still getting same issue..

Mark Collin

unread,
Mar 13, 2013, 2:39:58 AM3/13/13
to webd...@googlegroups.com

SafariDriver cannot deal with alerts.  It is a pure JavaScript implementation and because JavaScript is single threaded Alert dialogue boxes block execution of code and kill you test dead right there.

 

You will have to either use another browser or find a way to deal with alert boxes that does not involve selenium

--

Reply all
Reply to author
Forward
0 new messages