Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Yevgeniy Shunevych
    @YevgeniyShunevych
    You're welcome!
    andgorbachov
    @andgorbachov
    Could someone advise how to customize logger e.g. log level?
    andgorbachov
    @andgorbachov
    And Where can I find the log file if it is created by default OR how to create it if not?
    andgorbachov
    @andgorbachov
    Is there an ability to add an attributes to reach the following:
    Before click - Wait until element is displayed
    Before click - Wait until element is enabled
    After click - Wait until page is loaded.
    image.png
    Yevgeniy Shunevych
    @YevgeniyShunevych

    Could someone advise how to customize logger e.g. log level?

    Use WithMinLevel method:

    AtataContext.Configure().
        AddNLogLogging().
            WithMinLevel(LogLevel.Info).

    And Where can I find the log file if it is created by default OR how to create it if not?

    There is no default log file. It should be configured. For example, here is how to do it using NLog:

    1. Add NLog NuGet package to test project.
    2. Add NLog.config file to the same project with property "Copy to Output Directory" = "Copy if newer". Here is the sample that you can use: https://github.com/atata-framework/atata-sample-app-tests/blob/master/src/AtataSampleApp.UITests/NLog.config
    3. Add AddNLogLogging() to Atata configuration in SetUpFixtureor UITestFixture.

    You can also take a look at atata-framework/atata-sample-app-tests repository, where it is configured.

    Yevgeniy Shunevych
    @YevgeniyShunevych

    Is there an ability to add an attributes to reach the following:
    Before click - Wait until element is displayed
    Before click - Wait until element is enabled
    After click - Wait until page is loaded.

    Here it is:

    [WaitFor(Until.Visible, TriggerEvents.BeforeClick, TriggerPriority.High)]
    [WaitUntilEnabled(TriggerEvents.BeforeClick)]
    [WaitForDocumentReadyState(TriggerEvents.AfterClick)]
    public Button<_> SomeButton { get; private set; }

    But there is actually no need to explicitly wait until element is displayed. Atata, by default, finds only visible elements.

    Also I would better move the "wait until page is loaded" to a target page object class with TriggerEvents.Init.

    So I would better just leave single trigger [WaitUntilEnabled(TriggerEvents.BeforeClick)] for that button.

    andgorbachov
    @andgorbachov

    C# [WaitFor(Until.Visible, TriggerEvents.BeforeClick, TriggerPriority.High)] [WaitUntilEnabled(TriggerEvents.BeforeClick)] [WaitForDocumentReadyState(TriggerEvents.AfterClick)] public Button<_> SomeButton { get; private set; }>
    But there is actually no need to explicitly wait until element is displayed. Atata, by default, finds only visible elements.>
    Also I would better move the "wait until page is loaded" to a target page object class with TriggerEvents.Init.
    So I would better just leave single trigger [WaitUntilEnabled(TriggerEvents.BeforeClick)] for that button.

    There is the case:
    Application is single page.
    I have two Save button on the page - one is displayed and another is not. But them both are enabled...

    image.png
    AtataContext.Configure().
        AddNLogLogging().
            WithMinLevel(LogLevel.Info).
    Thank you!
    Yevgeniy Shunevych
    @YevgeniyShunevych
    You are welcome, @andgorbachov.
    andgorbachov
    @andgorbachov

    You are welcome, @andgorbachov.

    I still have a question ))
    There is the case:
    Application is single page.
    I have two Save button on the page - one is displayed and another is not. But them both are enabled...
    That's why it needs to take element with displayed property.

    Yevgeniy Shunevych
    @YevgeniyShunevych
    @andgorbachov, there is no way in Selenium to filter by element visibility using locators. Here few options that you can use.
    1. Filter using Linq:
      IWebElement visibleSaveLink = AtataContext.Current.Driver.FindElements(By.XPath("//a[text()='Save']"))
          .FirstOrDefault(x => x.Displayed);
    2. Use Atata's Get method that automatically takes only visible element:
      IWebElement visibleSaveLink = AtataContext.Current.Driver.Get(By.XPath("//a[text()='Save']"));
    3. If you use Atata page objects, then just define property this way:
      public Link<_> Save { get; private set; }
      Atata will automatically find the first visble link (<a>) with "Save" text.
    andgorbachov
    @andgorbachov
    Thank you a lot, Yevgeniy!
    Prab
    @TotalTest

    I'm trying to represent a KendoGridRow property as a DateTime. I have the following property:

    [Format("dd-MMM-yyyy hh:mm:ss")]
    public DateTime<_> CreatedOn { get; private set; }

    But I get the below error

    image.png
    Yevgeniy Shunevych
    @YevgeniyShunevych
    Hey @TotalTest. You've got a mistake in date/time format. As you have 24-hour time on your page, you need to use HH (or H) instead of hh. Here is a nice MSDN article: Custom date and time format strings.
    Yevgeniy Shunevych
    @YevgeniyShunevych
    Prab
    @TotalTest
    Thanks. The new package looks good and will try it out!
    Yevgeniy Shunevych
    @YevgeniyShunevych
    Welcome. I also plan to release main Atata package in day after tomorrow with a feature that ingrates Atata with Atata.WebDriverSetup.
    mdilovar
    @mdilovar

    Is there support for nested shaddow dom? This doesn't seem to work...

        public class SomePage : Page<SomePage>
        {
            [FindByCss("ion-router-outlet.hydrated", As = FindAs.ShadowHost)]
            [FindByCss("app-view-offers-on-my-listings>ion-content", As = FindAs.ShadowHost)]
            [FindByCss("app-offers-on-my-listings-grid>ion-grid", As = FindAs.ShadowHost)]
            [FindByCss("ion-grid", As = FindAs.ShadowHost)]
            [FindByCss("app-offers-on-my-listing-grid-item", As = FindAs.ShadowHost)]
            [FindByTitle]
            public Clickable<SomePage> SomeClickable{ get; private set; }
        }

    throws

    OpenQA.Selenium.NoSuchElementException : Unable to locate visible "Some Clickable" control element:
    - By: chain [XPath "..//*", CSS selector "app-view-offers-on-my-listings>ion-content"]
    - Search options: {Visibility=Visible, Timeout=5s, RetryInterval=0.5s, IsSafely=False}
    Yevgeniy Shunevych
    @YevgeniyShunevych
    @mdilovar, shadow DOM is supported. Ensure that your second locator "app-view-offers-on-my-listings>ion-content" is correct. You can also share a list of latest log messages. Trace log messages are very useful to understand the problem in such cases.
    Yevgeniy Shunevych
    @YevgeniyShunevych
    Atata.WebDriverExtras 1.5.0 is released with minor enhancement and added XML comments
    mdilovar
    @mdilovar
    OpenQA.Selenium.NoSuchElementException : Unable to locate visible "Update Offer Instructions" control element:
    - By: chain [XPath "..//*", CSS selector "app-view-offers-on-my-listings>ion-content"]
    - Search options: {Visibility=Visible, Timeout=5s, RetryInterval=0.5s, IsSafely=False}
    
    Context element:
    - Tag: slot
    - Location: {X=0, Y=0}
    - Size: {Width=0, Height=0}
    - Element ID: 14771a0b-4775-4558-bd13-13d6b5c8297d
       at Atata.StrategyScopeLocatorExecutor.ResolveResult(ComponentScopeLocateResult result, ISearchContext scopeSource, ComponentScopeLocateOptions scopeLocateOptions, SearchOptions searchOptions)
       at Atata.StrategyScopeLocatorExecutor.Execute(StrategyScopeLocatorExecutionData executionData)
       at Atata.StrategyScopeLocator.GetElement(SearchOptions searchOptions, String xPathCondition)
       at Atata.UIComponent`1.OnGetScopeElement(SearchOptions searchOptions)
       at Atata.UIComponent.GetScopeElement(SearchOptions searchOptions)
       at Atata.ClickUsingClickMethodAttribute.Execute[TOwner](IUIComponent`1 component)
       at Atata.LogManager.ExecuteSection(LogSection section, Action action)
       at Atata.LogManager.ExecuteSection(LogSection section, Action action)
       at Atata.Control`1.Click()
       at ShowingTime.QA.ShowingInstructionsDataExporter.nestedshaddows.nestedshaddowstest() in C:\Users\mdilovar\dataexporter\nestedshaddows.cs:line 13
    
    
    
    2021-02-16 16:39:03.4347  INFO Starting test: nestedshaddowstest
    2021-02-16 16:39:03.4667 TRACE > Set up AtataContext
    2021-02-16 16:39:03.4677 TRACE - Use: "Config.PROD.json" config
    2021-02-16 16:39:03.4687 TRACE - Set: BaseUrl=CENSORED
    2021-02-16 16:39:03.4697 TRACE - Set: ElementFindTimeout=5s; ElementFindRetryInterval=0.5s
    2021-02-16 16:39:03.4697 TRACE - Set: WaitingTimeout=5s; WaitingRetryInterval=0.5s
    2021-02-16 16:39:03.4707 TRACE - Set: VerificationTimeout=5s; VerificationRetryInterval=0.5s
    2021-02-16 16:39:03.4707 TRACE - Set: Culture=en-US
    2021-02-16 16:39:03.4847 TRACE - Set: DriverService=ChromeDriverService on port 51375
    2021-02-16 16:39:05.1169 TRACE - Set: Driver=ChromeDriver (alias=chrome)
    2021-02-16 16:39:05.1189 TRACE < Set up AtataContext (1.652s)
    2021-02-16 16:39:05.1689  INFO Go to URL "CENSORED"
    2021-02-16 16:39:06.2944  INFO Go to "Offer AC Frame" page
    2021-02-16 16:39:06.3544  INFO > Click "Update Offer Instructions" control
    2021-02-16 16:39:06.3584 TRACE - > Execute behavior ClickUsingClickMethodAttribute against "Update Offer Instructions" control
    2021-02-16 16:39:06.4014 TRACE - - > Find visible elements by CSS selector "ion-router-outlet.hydrated" in ChromeDriver
    2021-02-16 16:39:06.4614 TRACE - - < Find visible elements by CSS selector "ion-router-outlet.hydrated" in ChromeDriver (0.057s) >> Element { Id=abd7204d-d935-4ad6-a735-c72fca7858f6 }
    2021-02-16 16:39:06.4654 TRACE - - > Find visible element by XPath "descendant-or-self::*" in Element { Id=abd7204d-d935-4ad6-a735-c72fca7858f6 }
    2021-02-16 16:39:06.5134 TRACE - - < Find visible element by XPath "descendant-or-self::*" in Element { Id=abd7204d-d935-4ad6-a735-c72fca7858f6 } (0.047s) >> Element { Id=abd7204d-d935-4ad6-a735-c72fca7858f6 }
    2021-02-16 16:39:06.5175 TRACE - - > Execute script "if (!arguments[0].shadowRoot) { throw 'Element doesn\'t have shadowRoot value. Element: ' + argum..." with argument: Element { Id=abd7204d-d935-4ad6-a735-c72fca7858f6 }
    2021-02-16 16:39:06.5274 TRACE - - < Execute script "if (!arguments[0].shadowRoot) { throw 'Element doesn\'t have shadowRoot value. Element: ' + argum..." with argument: Element { Id=abd7204d-d935-4ad6-a735-c72fca7858f6 } (0.010s) >> Element { Id=14771a0b-4775-4558-bd13-13d6b5c8297d }
    2021-02-16 16:39:06.5304 TRACE - - > Find visible elements by chain [XPath "..//*", CSS selector "app-view-offers-on-my-listings>ion-content"] in Element { Id=14771a0b-4775-4558-bd13-13d6b5c8297d }
    2021-02-16 16:39:11.5453 TRACE - - < Find visible elements by chain [XPath "..//*", CSS selector "app-view-offers-on-my-listings>ion-content"] in Element { Id=14771a0b-4775-4558-bd13-13d6b5c8297d } (5.014s) >> []
    2021-02-16 16:39:11.594
    Thanks @YevgeniyShunevych. Here are the logs ^
    Yevgeniy Shunevych
    @YevgeniyShunevych
    The log looks fine. It found and entered first shadow element ("ion-router-outlet.hydrated"), but then was not able to find "app-view-offers-on-my-listings>ion-content" inside it. Maybe you can also share the sreenshot of HTML DOM that contains these shadow elements? I can only think that "app-view-offers-on-my-listings>ion-content" CSS path is incorrect.
    Prab
    @TotalTest
    Is there a way to use the Focus() method on a Link/Button Delegate? I was thinking of changing all relevant properties to Delegates but the Focus() is now not compiling.
    It's not a big issue just to revert to a Link or Button if it's recomended.
    Yevgeniy Shunevych
    @YevgeniyShunevych

    @TotalTest, I don't have a strong recommendation which is better to use, Button or ButtonDelegate.

    Currently there is no Focus() extension method for delegates. Just forgot about it. But you can do it thru .GetControl().Focus(). GetControl() returns you Button<_> control, which has all methods.

    I will add Focus extension method for delegates in scope of upcoming Atata 1.10 version.

    Yevgeniy Shunevych
    @YevgeniyShunevych
    Atata 1.10.0 is released with driver auto-setup, new properties of attributes, and other useful features
    Prab
    @TotalTest

    I'm attempting to use the new AutoSetUpConfiguredDrivers() to manage my webdrivers. For internet explorer is there a way to download the 32 bit version of the driver instead? The 64 but version results in sending keys being very very slow and eventually timing out. It seems to be a known issue and the suggestion is to use the 32 bit driver instead, which is a lot quicker.

    Also what would be the difference between AutoSetUpDriverToUse() and AutoSetUpConfiguredDrivers()?

    Yevgeniy Shunevych
    @YevgeniyShunevych
    @TotalTest, here is the difference between AutoSetUpDriverToUse() and AutoSetUpConfiguredDrivers():
    AtataContext.GlobalConfiguration
        .UseFirefox()
        .UseChrome()
        .AutoSetUpDriverToUse();
    // Configures only Chrome driver, the last set driver that will be used by tests.
    AtataContext.GlobalConfiguration
        .UseFirefox()
        .UseChrome()
        .AutoSetUpConfiguredDrivers();
    // Configures both Firefox and Chrome drivers.
    // Makes sense only when you do multi-browser testing within the single tests run.
    Yevgeniy Shunevych
    @YevgeniyShunevych
    Regarding Internet Explorer x32, I actually missed this moment. It cannot be configured now. I will have to add a configuration for that and make v1.1.0 of Atata.WebDriverSetup. Thanks for pointing this.
    Prab
    @TotalTest
    Thanks for the explanation, no problem I can wait for the IE32 update so no rush.
    Yevgeniy Shunevych
    @YevgeniyShunevych
    Atata.WebDriverSetup 1.1.0 is released with architecture configuration and async SetUp methods
    Prab
    @TotalTest
    Brilliant, I have it working. I guess the 'WithX32Architecture()' will be added to the AtataContext.GlobalConfiguration as a separate release?
    Maybe part of InternetExplorerAtataContextBuilder
    Yevgeniy Shunevych
    @YevgeniyShunevych
    Atata Templates 1.10.0 Visual Studio extension is released with added usage of Atata.WebDriverSetup package
    Yevgeniy Shunevych
    @YevgeniyShunevych

    @TotalTest, actually, I was going to stop at this point. Here is how it can be setup for x32 IE in sample SetUpFixture.

    You know, I don't want to copy configuration properties/methods from Atata.WebDriverSetup package to Atata classes, and then map them using reflection.
    And I don't want to make references between these packages, to keep a possibility for people to use them separately.

    Prab
    @TotalTest
    Makes sense, thanks for the quick updates and responses.
    Yevgeniy Shunevych
    @YevgeniyShunevych
    Sure, no problem.
    Yevgeniy Shunevych
    @YevgeniyShunevych
    Just updated an old article Atata - C# Web Test Automation Framework. Check it out if you missed it
    Ben Zumhagen
    @bzumhagen
    Hi, is it possible to use WaitTo on a button delegate? wondering if i'm doing something wrong
    i.e. I want to wait until a buttondelegate is visible
    Yevgeniy Shunevych
    @YevgeniyShunevych
    Hey @bzumhagen. For delegates WaitTo is available as extension method (not a property, like controls have): SomeButtonDelegate.WaitTo().BeVisible(). Also I need to mention that WaitTo, as well as some other delegate extension methods, was added in the latest Atata v1.10.0.
    For older Atata versions you can achieve the same by: SomeButtonDelegate.GetControl().WaitTo.BeVisible().
    Or change the type of the property from ButtonDelegate<_> to Button<_>.
    Ben Zumhagen
    @bzumhagen
    :thumbsup: thanks!
    Yevgeniy Shunevych
    @YevgeniyShunevych
    You are welcome, @bzumhagen.