Re: [geb-user] Re: Chrome Driver Version 81 not found

2020-06-15 Thread Shreya J
Marcin, that was indeed the case. Thank you! 

My chrome updated recently to 83 and I was able to use 83.0.4103.39 as 
listed on here for mac - 
https://github.com/webdriverextensions/webdriverextensions-maven-plugin-repository/blob/master/repository-3.0.json
  
Thanks
 
again for taking the time to respond and putting the links in the answer. 
They are very helpful. 


- Shreya 

On Monday, June 15, 2020 at 3:09:53 PM UTC-4, Marcin Erdmann wrote:
>
> Hi Shreya,
>
> On Mon, Jun 15, 2020 at 1:15 PM varun jain  > wrote:
>
>> One way to overcome this problem is to have chrome driver binary in the 
>> project and set the path to it in the project. 
>>
>
> I would advise against doing so. One should not put binaries under source 
> control, especially such that can be easily resolved by the build.
>
> You are getting a DriverUrlNotFoundException because the version of 
> chromedriver binary you used does not match one listed in 
> https://github.com/webdriverextensions/webdriverextensions-maven-plugin-repository/blob/master/repository-3.0.json
>  (see 
> this section of the manual for Gradle webdriver binaries plugin to 
> understand the significance of that file: 
> https://github.com/erdi/webdriver-binaries-gradle-plugin/blob/master/README.md#configuring-download-urls).
>  
> If your Chrome version is 81.0.4044.138 then you should use 81.0.4044.69 as 
> the version of chromedriver binary.
>
> Cheers,
> Marcin
>

-- 
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 geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/7d28991f-87b1-45a3-b461-c1645ecc94a9o%40googlegroups.com.


Re: [geb-user] Re: Chrome Driver Version 81 not found

2020-06-15 Thread Marcin Erdmann
Hi Shreya,

On Mon, Jun 15, 2020 at 1:15 PM varun jain  wrote:

> One way to overcome this problem is to have chrome driver binary in the
> project and set the path to it in the project.
>

I would advise against doing so. One should not put binaries under source
control, especially such that can be easily resolved by the build.

You are getting a DriverUrlNotFoundException because the version of
chromedriver binary you used does not match one listed in
https://github.com/webdriverextensions/webdriverextensions-maven-plugin-repository/blob/master/repository-3.0.json
(see
this section of the manual for Gradle webdriver binaries plugin to
understand the significance of that file:
https://github.com/erdi/webdriver-binaries-gradle-plugin/blob/master/README.md#configuring-download-urls).
If your Chrome version is 81.0.4044.138 then you should use 81.0.4044.69 as
the version of chromedriver binary.

Cheers,
Marcin

-- 
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 geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQQitJJXo1zbEHQHAYgyoxn3Zb-i9NXVxY%3D7hEegv_EYBQ%40mail.gmail.com.


Re: [geb-user] WaitFor in Geb

2020-06-15 Thread Marcin Erdmann
OperationUtil should not extend Page. After that there are two options:

1. You instantiate geb.waiting.Wait by hand and then call waitFor on it:

import geb.waiting.Wait

new Wait(60).waitFor {
objName.click()
}

2. You pass an instance of configuration to the constructor of
OperationUtil and have an instance of geb.waiting.DefaultWaitingSupport
which you delegate to:

import geb.waiting.DefaultWaitingSupport
import geb.waiting.WaitingSupport
import geb.Configuration

@Delegate
private final WaitingSupport waitingSupport

OperationUtil(Configuration configuration) {
this.waitingSupport = new DefaultWaitingSupport(configuration)
}

void someMethod() {
waitFor {
//some condition
}
}

and then in your page you initiate it like this:

new OperationUtil(browser.config)

As a side note, please be aware that having code which mutates state, i.e.
clicks on things, inside of the waitFor condition is an anti-pattern and I
would advise against doing that.

Marcin

On Fri, Jun 12, 2020 at 7:56 AM Avinash Kumar 
wrote:

> Hi,
>
> i tried with the same way as :
>
>   waitFor(60) {
> ObjName.click()
> true
>   }
>
>   but it didn't worked
>
>
>   My exact issue is that waitFor works find in "Login" class which follows
> exact geb POM where i have created static at , static url , static content
>   and follows with method implementation and same class i have extends
> from Page(geb.Page),
>
>   package pages
>
> import geb.Browser
> import geb.Page
> import modules.OperationUtil
>
>
>
> class Login extends Page {
>
>
> static at = {title == "Login"}
>
> static content = {
> usernameField {$('input#username')}
> passwordField {$('input#password')}
> logInButton {$('button#login-submit')}
>
> }
>
> def "login To App"(username, password) {
> try {
> OperationUtil operationUtil = new OperationUtil();
>
> waitFor(60) {
> operationUtil.enterVal(usernameField, username);
> operationUtil.enterVal(passwordField, password);
> }
>
> operationUtil.clickAnElement(logInButton)
>
> waitFor(Integer.parseInt(ju.getJsonValue("maxWait"))) {
> logoutButton.displayed
> slide.displayed }
> }
> catch(Exception e){
> new ExceptionHandler().customizedException("Cannot login into
> the application");
> e.printStackTrace();
> }
> }
> }
>
>   but in other class "OperationUtil" where i have only extends with Page
> (geb.Page) and does method implementation.
>
>   package modules
>
>   import geb.Page
>
>   class OperationUtil extends Page {
>
>
> def clickAnElement(objName){
> waitFor(60) {
> objName.click()
> return true
> }
>
> }
>
>
>
> }
>
>
>
> so waitFor at OperationUtil doesn't work.
>
>
>
> 2020-06-12 11:53:42 ERROR - Issue with login: Instance of page class
> modules.OperationUtil has not been initialized.
> Please pass it to Browser.to(), Browser.via(), Browser.page() or
> Browser.at() before using it.
> 2020-06-12 11:53:42 ERROR - Issue with login: Instance of page class
> modules.OperationUtil has not been initialized.
> Please pass it to Browser.to(), Browser.via(), Browser.page() or
> Browser.at() before using it.
> geb.error.PageInstanceNotInitializedException: Instance of page class
> modules.OperationUtil has not been initialized.
> Please pass it to Browser.to(), Browser.via(), Browser.page() or
> Browser.at() before using it
>
>
>
> Regards,
> Avinash Kumar
>
> On Fri, Jun 12, 2020 at 10:39 AM Michael Kutz 
> wrote:
>
>> The waitFor expects a closure returning a boolean value. Once the value
>> returned is true, the waiting ends.
>>
>> As Groovy interprets basically any object as an boolean (see
>> http://groovy-lang.org/semantics.html#Groovy-Truth), this works great
>> with Geb's NonEmptyNavigator (true) and EmptyNavigator (false).
>>
>> In your case, you call click. As click returns null, the result will
>> never be true.
>>
>>   waitFor(60) { ObjName }.click()
>>
>> Might work, but you should put the object retrieving inside the closure.
>>
>>   waitFor(60) {
>> ObjName.click()
>> true
>>   }
>>
>> Might also work if the first line on the closure will throw an exception,
>> which would be catched by Wait. If no exception is thrown, the true will be
>> returned and the waiting will end.
>>
>> Kind regards,
>> Micha
>>
>> Avinash Kumar  schrieb am Do., 11. Juni
>> 2020, 16:50:
>>
>>> Hi,
>>>
>>> I am trying to use waitFor method in different class other than page
>>> class.
>>>
>>> For example:
>>>
>>> class test extends page {
>>>
>>>
>>> def clickAnElement(ObjName)
>>> {
>>>
>>> waitFor(60)
>>>  {
>>>  ObjName.click()
>>> }
>>> }
>>> }
>>>
>>>
>>> and clickAnElement, i am calling from one page class .
>>> but code fails at WaitFor() as WaitFor is not working for me in class
>>> other than page class.
>>>
>>>
>>> Can any help me out 

[geb-user] Re: Chrome Driver Version 81 not found

2020-06-15 Thread varun jain
Hi Shreya,

One way to overcome this problem is to have chrome driver binary in the 
project and set the path to it in the project. 

*Steps*

   1. Update your Chrome to the latest version 83.0.43 as Chrome usually 
   auto-updates
   2. Download the chrome driver binary for your browser ( Chrome 
   83.0.43...) in your system.  
   3. Put the binary somewhere in the resources 
   /src/main/resources/browser-drivers/chromedrivermac
   4. In build.gradle you can set system property to define the path
   
   systemProperties = [
   macWebdriverChromeDriver: 
"${rootPath}/src/main/resources/browser-drivers/chromedrivermac"
   ]
   
   
   5. In GebConfig.groovy, Set the path 
   
   def setDriverExec() {
   if (SystemUtils.IS_OS_MAC_OSX || SystemUtils.IS_OS_MAC) {
   System.setProperty("webdriver.chrome.driver", 
System.getProperty("macWebdriverChromeDriver"))
   
   }
   
   }
   
   
   Varun
   
   
   
   

On Thursday, June 11, 2020 at 9:41:43 AM UTC-5, Shreya J wrote:
>
> Hi, 
>
> I have a couple of questions regarding the github code. I am just trying 
> to run the code as is to initially get an idea of whats going on. I cloned 
> the repository and tried running ./gradlew chromeTest but my Chrome version 
> is 81. I updated the driver version in the build.gradle file based on the 
> driver version for Chrome version 81 but I get an error that the DriverURL 
> is not found.
> > com.github.erdi.gradle.webdriver.repository.DriverUrlNotFoundException: 
> Driver url not found for name: "chromedriver", version: "81.0.4044.138", 
> platform: "mac", bit: "64 or 32"
>
> Do I need to specify this as an environment variable or something for my 
> IDE to know that I did download the chromeDriver with that version 
> specified? 
>
> Thanks
>
>

-- 
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 geb-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/7e274be8-f350-4f52-9545-2822d6535318o%40googlegroups.com.