MikeMugu/Zukini

Use custom webdriver profile

Closed this issue · 9 comments

Is there a way to use a custom driver profile with Zukini (like mentioned at this link)?
https://github.com/featurist/coypu#using-a-custom-selenium-webdriver-profile

Background to this is that our tests are breaking when using Chrome on TeamCity. We've worked out we solve this by adding the "no-sandbox" flag to ChromeOptions and using that driver. But I can't see how we can create our own BrowserSession with our custom driver in Zukini.

Many thanks.

Yes, you should be able to add a case in the Hooks.cs file in the
GetBrowser() method:

    /// <summary>
    /// Helper method to retrieve the browser based off of the string

that is passed in.
///

    /// <param name="browserName">Name of the browser.</param>
    /// <returns></returns>
    /// <exception cref="System.ArgumentException"></exception>
    private Browser GetBrowser(string browserName)
    {
        switch (browserName.ToLower())
        {
            case "firefox":
                return Browser.Firefox;
            case "chrome":
                return Browser.Chrome;
            case "ie":
            case "internetexplorer":
                return Browser.InternetExplorer;
            default:
                throw new ArgumentException(String.Format("Specified

browserName '{0}' is not valid.", browserName));
}
}

You could modify this code to accept another browser name (e.g.
"customfirefoxdriver". Then in the case, instead of returning one of the
default Browsers, return your custom Browser that uses your custom profile.

I can look at simplifying this and providing an example but that should do
the trick.

Let me know if you run into issues.

Thanks,

Mike

On Thu, Aug 11, 2016 at 11:57 AM, s-kavanagh notifications@github.com
wrote:

Is there a way to use a custom driver profile with Zukini (like mentioned
at this link)?
https://github.com/featurist/coypu#using-a-custom-selenium-
webdriver-profile

Background to this is that our tests are breaking when using Chrome on
TeamCity. We've worked out we solve this by adding the "no-sandbox" flag to
ChromeOptions and using that driver. But I can't see how we can create our
own BrowserSession with our custom driver in Zukini.

Many thanks.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#7, or mute the thread
https://github.com/notifications/unsubscribe-auth/AINx73mnb9vj98xxy2yYQwcsq0BhjW7Nks5qe0Z0gaJpZM4JiRhD
.

Hi @MikeMugu - Thanks for getting back to me.

I'm probably missing something, but I think I need to be able to create a coypu BrowserSession with this new custom profile, not just change the Browser in the SessionConfiguration. Going by the note at the bottom of the link I mentioned

When you pass a custom driver, the Driver and Browser settings in ConfigurationSettings are ignored

Changing the Browser in the method you picked out above would only change the type in the ConfigurationSettings that are being ignored?

Ah, I will have to take a closer look. Let me try to get you a working example this weekend if that works?

Sent from my iPhone

On Aug 12, 2016, at 3:49 AM, s-kavanagh notifications@github.com wrote:

Hi @MikeMugu - Thanks for getting back to me.

I'm probably missing something, but I think I need to be able to create a coypu BrowserSession with this new custom profile, not just change the Browser in the SessionConfiguration. Going by the note at the bottom of the link I mentioned

When you pass a custom driver, the Driver and Browser settings in ConfigurationSettings are ignored

Changing the Browser in the method you picked out above would only change the type in the ConfigurationSettings that are being ignored?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

That would be fantastic - thank you. 

Hello s-kavanagh,

I have published a new version of Zukini up that provides examples on how
to provide your own Chrome/Firefox driver. The example shows how to set the
no-sandbox flag in Chrome. Take a look at the Hooks.cs file that is located
in the Examples project. The commit is here:
5ad7a8c

Please let me know if you have any questions.

Thanks,

Mike

On Fri, Aug 12, 2016 at 8:03 AM, s-kavanagh notifications@github.com
wrote:

That would be fantastic - thank you.

On Fri, Aug 12, 2016 at 12:59 PM +0100, "Mike Watkins" <
notifications@github.com> wrote:

Ah, I will have to take a closer look. Let me try to get you a working
example this weekend if that works?

Sent from my iPhone

On Aug 12, 2016, at 3:49 AM, s-kavanagh notifications@github.com
wrote:

Hi @MikeMugu - Thanks for getting back to me.

I'm probably missing something, but I think I need to be able to create
a coypu BrowserSession with this new custom profile, not just change the
Browser in the SessionConfiguration. Going by the note at the bottom of the
link I mentioned

When you pass a custom driver, the Driver and Browser settings in
ConfigurationSettings are ignored

Changing the Browser in the method you picked out above would only
change the type in the ConfigurationSettings that are being ignored?

You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub, or mute the thread.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#7 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AINx76574gLaEbxgpzta051mJwzlH2hrks5qfGEdgaJpZM4JiRhD
.

Hi Mike, 
I'll be able to try this out tomorrow properly but the commit looks like it should do just what I needed. I'll keep you posted. Many thanks for your help on this. 
Sam

Sure - good luck. It was a tricky one, took me a little while to figure out
what to do there. Hope it helps.

Regards,
Mike

On Sun, Aug 14, 2016 at 3:00 PM, s-kavanagh notifications@github.com
wrote:

Hi Mike,
I'll be able to try this out tomorrow properly but the commit looks like
it should do just what I needed. I'll keep you posted. Many thanks for your
help on this.
Sam


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#7 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AINx7-qD0K1fk9IHniFO6Q3bcC1ndk15ks5qf2W9gaJpZM4JiRhD
.

Hi @MikeMugu just to let you know this worked perfectly. All our tests are running on CI again now. Many thanks, Sam

Great - thanks for the confirmation!

On Mon, Aug 22, 2016 at 5:15 AM, s-kavanagh notifications@github.com
wrote:

Hi @MikeMugu https://github.com/MikeMugu just to let you know this
worked perfectly. All our tests are running on CI again now. Many thanks,
Sam


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#7 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AINx70E0r_9eKtAZKCOXIRvBPLj19boOks5qiWjCgaJpZM4JiRhD
.