TestStack / TestStack.Seleno

Seleno helps you write automated UI tests in the right way by implementing Page Objects and Page Components and by reading from and writing to web pages using strongly typed view models.
http://teststack.github.com/TestStack.Seleno/
MIT License
180 stars 60 forks source link

How do you start a seleno host with maximized browser window? #212

Closed 82949712 closed 9 years ago

82949712 commented 9 years ago

It starts with a half sized window, can I start with a maximized window? Thanks

sirj77 commented 9 years ago

You just need to add this line into your Host class:

Instance.Application.Browser.Manage().Window.Maximize();
robdmoore commented 9 years ago

Thanks @sirj77

thnk2wn commented 8 years ago

When I do this it does maximize the browser but that appears to cause subsequent test inputs to fail. Removing the maximize code the test works as expected but non-maximized. Is the below incorrect or maybe a different in Chrome now?

public static class Host
{
    public static readonly SelenoHost Instance = new SelenoHost();

    static Host()
    {
        var chromeOptions = new ChromeOptions();            
        Instance.Run("Hakata.Web", 6600, c => c
            .UsingLoggerFactory(new ConsoleFactory())
            .WithRemoteWebDriver(() => BrowserFactory.Chrome(chromeOptions))
            .UsingCamera(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TestScreenShots"))
        );

        Instance.Application.Browser.Manage().Window.Maximize();
    }
}
robdmoore commented 8 years ago

That should definitely work. Have you tried setting an explicit size rather than maximise to see if the same problem happens?

Also, what error does it fail with on the second test run?

Rob Moore | Readify Principal Consultant, Technical Specialist (Microsoft Azure) | m +61 400 777 763 | e rob.moore@readify.net | w readify.net

On 9 Sep 2016, at 7:46 AM, Geoff Hudik notifications@github.com wrote:

When I do this it does maximize the browser but that appears to cause subsequent test inputs to fail. Removing the maximize code the test works as expected but non-maximized. Is the below incorrect or maybe a different in Chrome now?

public static class Host { public static readonly SelenoHost Instance = new SelenoHost();

static Host()
{
    var chromeOptions = new ChromeOptions();            
    Instance.Run("Hakata.Web", 6600, c => c
        .UsingLoggerFactory(new ConsoleFactory())
        .WithRemoteWebDriver(() => BrowserFactory.Chrome(chromeOptions))
        .UsingCamera(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TestScreenShots"))
    );

    Instance.Application.Browser.Manage().Window.Maximize();
}

} — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.

thnk2wn commented 8 years ago

@robdmoore Not sure what changed but this seems to be working now. Thanks