Hi Marcin,

Your script is running with exception as well on my machine. It turns out 
that I had to add baseNavigatorWaiting property in Browser config to 
reproduce issue with your script:
@Grab("org.gebish:geb-core:1.0")
@Grab("org.seleniumhq.selenium:selenium-firefox-driver:2.53.1")
@GrabExclude("org.codehaus.groovy:groovy-all")
import geb.Browser
import geb.Module

Browser.drive {
    browser.config.baseNavigatorWaiting = true
    go "http://www.gebish.org/";

    js.exec('alert("ups!")')
    module(SomeSimpleModule)

    assert title == "Geb - Very Groovy Browser Automation"
}

class SomeSimpleModule extends Module {}



W dniu wtorek, 1 listopada 2016 22:25:50 UTC+1 użytkownik Marcin Erdmann 
napisał:
>
> Hi Adam,
>
> I've just executed the following script on my machine:
>
> -------------
>
> @Grab("org.gebish:geb-core:1.0")
> @Grab("org.seleniumhq.selenium:selenium-firefox-driver:2.53.1")
> @GrabExclude("org.codehaus.groovy:groovy-all")
> import geb.Browser
> import geb.Module
>
> Browser.drive {
>     go "http://www.gebish.org/";
>
>     js.exec('alert("ups!")')
>     module(SomeSimpleModule)
>
>     assert title == "Geb - Very Groovy Browser Automation"
> }
>
> class SomeSimpleModule extends Module {}
>
> ---------------
>
> With FF 44.0 installed, using groovy 2.4.5 and got the following exception:
>
> org.openqa.selenium.UnhandledAlertException: Unexpected modal dialog 
> (text: ups!): ups!
> Build info: version: '2.53.1', revision: 
> 'a36b8b1cd5757287168e54b817830adce9b0158d', time: '2016-06-30 19:26:09'
> System info: host: 'Erdis-MacBook-Pro.local', ip: '192.168.1.72', os.name: 
> 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.6', java.version: 
> '1.8.0_102'
> Driver info: org.openqa.selenium.firefox.FirefoxDriver
> Capabilities [{applicationCacheEnabled=true, rotatable=false, 
> handlesAlerts=true, databaseEnabled=true, version=44.0, platform=MAC, 
> nativeEvents=false, acceptSslCerts=true, webStorageEnabled=true, 
> locationContextEnabled=true, browserName=firefox, takesScreenshot=true, 
> javascriptEnabled=true, cssSelectorsEnabled=true}]
> Session ID: 8039421b-b0ac-744d-86f3-0779d6c5de99
> *** Element info: {Using=xpath, value=/*}
> at 
> org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
> at 
> org.openqa.selenium.remote.ErrorHandler.createUnhandledAlertException(ErrorHandler.java:187)
> at 
> org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:154)
> at 
> org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
> at 
> org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:363)
> at 
> org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:500)
> at org.openqa.selenium.By$ByXPath.findElement(By.java:361)
> at 
> org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:355)
> at org.openqa.selenium.WebDriver$findElement$0.call(Unknown Source)
> at 
> geb.navigator.factory.BrowserBackedNavigatorFactory.createBase(BrowserBackedNavigatorFactory.groovy:39)
> at 
> geb.navigator.factory.BrowserBackedNavigatorFactory.getBase(BrowserBackedNavigatorFactory.groovy:45)
> at 
> geb.navigator.factory.AbstractNavigatorFactory.getProperty(AbstractNavigatorFactory.groovy)
> at geb.content.NavigableSupport.getBase(NavigableSupport.groovy:34)
> at geb.content.NavigableSupport.module(NavigableSupport.groovy:207)
> at geb.content.Navigable$module.call(Unknown Source)
> at geb.Page.module(Page.groovy:491)
> at geb.Browser.methodMissing(Browser.groovy:206)
> at geb.Browser.invokeMethod(Browser.groovy)
> at geb$_run_closure1.doCall(geb.groovy:11)
> at geb$_run_closure1.doCall(geb.groovy)
> at geb.Browser.drive(Browser.groovy:1061)
> at geb.Browser$drive$0.callStatic(Unknown Source)
> at geb.Browser.drive(Browser.groovy:1031)
> at geb.Browser$drive.call(Unknown Source)
> at geb.run(geb.groovy:7)
>
> Are you sure that you're not seeing the exception being thrown? My 
> versions are slightly different than yours but I don't see how that could 
> cause different behaviour for me and for you.
>
> Marcin
>
> On Thu, Oct 27, 2016 at 1:36 PM, Adam Bęben <[email protected] 
> <javascript:>> wrote:
>
>> Meta:
>> OS: Windows 7
>> Selenium version: 2.52.0
>> Browser: Firefox v.45.4.0
>> Geb version: 1.0
>> Groovy version: 2.4.6
>>
>> Expected Behavior:
>> Test should throw UnhandledAlertException
>>
>> Actual Behavior:
>> Creating module without Navigator context is silently accepting alert
>>
>> Steps to reproduce:
>> import geb.Browser
>>
>> Browser.drive {
>>     go "http://www.gebish.org/";
>>
>>     js.exec('alert("ups!")')
>>     module(SomeSimpleModule)
>>
>>     assert title == "Geb - Very Groovy Browser Automation"
>> }
>>
>> I think the above script should not pass and should throw the 
>> UnhandledAlertException. But creating module this way:
>> module(SomeSimpleModule)
>> is silently accepting alert instead of throwing UnhandledAlertException.
>>
>> So the question is: bug or not?
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Geb User Mailing List" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/geb-user/dd5245ab-a587-4d43-b92e-9033bcf970ac%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/geb-user/dd5245ab-a587-4d43-b92e-9033bcf970ac%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/cac93bfc-23ac-476d-b9ff-2510bef17035%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to