Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    cowilliams
    @cowilliams
    The exception is being thrown on Resume.Click(), so it doesn't look like that's the case. When i debug it seems to be doing everything right, it gets to that page, then it clicks the resume and closes out of the alert, but before it hits the wait it returns the exception. As if it was closing the alert box after it's already been closed, but if I remove the .Click(), it just doesn't close the window at all.
    Rafe
    @kemmis_twitter
    Greetings - what is the recommended way of configuring the BaseUrl in your project so you can have it change based on what environment you are running in?
    Yevgeniy Shunevych
    @YevgeniyShunevych
    Hi. You can check out JSON Configuration: Multi-Environment as an approach that we often use.
    Yevgeniy Shunevych
    @YevgeniyShunevych
    Yevgeniy Shunevych
    @YevgeniyShunevych
    Atata 1.1.0 is released with 40 enhancements and features
    Yevgeniy Shunevych
    @YevgeniyShunevych
    Atata Templates 1.1.0 Visual Studio extension is released with support of Visual Studio 2019 and update of package references
    Yevgeniy Shunevych
    @YevgeniyShunevych
    Jan Erik Digernes
    @JEDigernes_twitter

    Hi.

    I have been using KendoDropDownList and it has been working well.

    An change to the website I am testing has added an extra div to the dropdown like so:

    <li tabindex="-1" role="option" unselectable="on" class="k-item" aria-selected="false" data-offset-index="1">
    <div>
    <div class="header">The header</div>
    <div class="description">The description</div> <!-- I am new -->
    </div>
    </li>

    This means I can no longer locate the option I am looking for by:

    MyDropdown.Set("The header");

    "Unable to locate element: \"The header\" drop-down option. By.XPath: .//*[contains(concat(' ', normalize-space(@class), ' '), ' k-animation-container ')]//ul[contains(concat(' ', normalize-space(@class), ' '), ' k-list ')]/li[normalize-space(.)='The header']"

    Will I have to override GetDropDownOption or is there some other way to accomplish this?

    Yevgeniy Shunevych
    @YevgeniyShunevych

    Hey,

    KendoDropDownList supports ItemValueXPathAttribute and ValueXPathAttribute to customize location of elements (add extra XPath'es).

    You may also check how they are used internally in KendoDropDownList`2.cs.

    So for your case, you can add [ItemValueXPath("//div[@class='header']")] attribute to KendoDropDownList property. Meaning that Atata should take div.header located at any level of corresponding li and match content of exactly this element.

    Combined XPath for drop-down option search using this attribute would be corrected from:

    .//*[contains(concat(' ', normalize-space(@class), ' '), ' k-animation-container ')]//ul[contains(concat(' ', normalize-space(@class), ' '), ' k-list ')]/li[normalize-space(.)='The header']

    to the following:

    .//*[contains(concat(' ', normalize-space(@class), ' '), ' k-animation-container ')]//ul[contains(concat(' ', normalize-space(@class), ' '), ' k-list ')]/li//div[@class='header'][normalize-space(.)='The header']
    Jan Erik Digernes
    @JEDigernes_twitter
    That worked perfectly. Thank you so much for great support as always!
    Yevgeniy Shunevych
    @YevgeniyShunevych
    Welcome.
    Yevgeniy Shunevych
    @YevgeniyShunevych
    Atata 1.2.0 is released with several new features https://atata.io/blog/2019/06/13/atata-1.2.0-released/
    Mauro
    @andymaster01
    Hi @YevgeniyShunevych , I'm starting to explore the framework and I was looking for guidance about when to use UIComponent's vs Control's, I'm targeting a SPA with quite a bit of dynamic behaviour
    Yevgeniy Shunevych
    @YevgeniyShunevych

    Hey @andymaster01 . You should operate Control (and inherited ones) type for controls and PageObject (Page, PopupWindow) for page objects.

    UIComponent is just a base class for Control and PageObject. UIComponent type can be used in methods. But there is no need to inherit it for custom types, rather inherit Control.

    Mauro
    @andymaster01
    @YevgeniyShunevych thanks, another question: In a scenario where a button can redirect you or show an error message in a div, what's the recommended approach?
    Mauro
    @andymaster01
    I guess is something like: for the error case, use .Click(), for the redirect case, use ClickAndGo<>(), that's correct?
    Yevgeniy Shunevych
    @YevgeniyShunevych
    Absolutely! Was just writing that.
    Mauro
    @andymaster01
    perfect, thanks for all the work on this framework, I'm just starting to using it and everything seem to be well designed!
    Yevgeniy Shunevych
    @YevgeniyShunevych
    Thanks. Let us know if you face some issues with Atata.
    Mauro
    @andymaster01
    @YevgeniyShunevych , not sure if this is by design, but when I use [FindByClass(TermMatch.StartsWith, "x_b")] it appends a space on the generated selector, like this: .//[contains(concat(' ', normalize-space(@class), ' '), ' x_b ')]/descendant-or-self::
    this makes atata not to find the control
    Yevgeniy Shunevych
    @YevgeniyShunevych

    Ouch. FindByClassAttribute doesn't handle TermMatch currently as I see in sources. Never had to use it with specific TermMatch.

    You can then use [FindByAttribute("class", TermMatch.StartsWith, "x_b")] or [FindByAttribute("class", TermMatch.Contains, "x_b")].

    Mauro
    @andymaster01
    got it, as a workaround I was using xpath(starts-with..., but I get the FindByAttribute makes more sense
    Ivan
    @IBozilov_gitlab

    Hi @YevgeniyShunevych , is there a way to set a value to a div element?
    The reason i'm asking is because my team is using Summernote JQuery plugin for adding rich text editor to text areas and the plugin replaces the text area with the following structure and i can't find a way to set a value to it when writing the automation test

    <div class="note-editor note-frame panel panel-default">
    <div class="note-editing-area">
    <textarea class="note-codable"></textarea>
    <div class="note-editable panel-body" contenteditable="true" style="height: 200px;">
    <p><br></p>
    </div>
    </div>
    </div>

    The only way the form will accept a value is if it is placed inside the <div class="note-editable panel-body" contenteditable="true" style="height: 200px;"></div> element.
    I have omitted the unnecessary elements which are the text editor functions.

    Yevgeniy Shunevych
    @YevgeniyShunevych
    Hey @IBozilov_gitlab, I have created an example Custom Rich Text Editor Based on contenteditable specifically for Summernote.
    Ivan
    @IBozilov_gitlab
    @YevgeniyShunevych thank you for the fast reply and all your good work! :)
    cowilliams
    @cowilliams
    Having some issues with the Hover() method on a <li> control I'm trying to get to load. Originally the hover was triggered from css, but now the website has been updated to be in js code, using the mouseenter event. Now, using the hover on the li, or the link within the menu, will not trigger that event. Is this a known difference in selenium webdriver? Is there some other way I can force the webdriver to move the cursor into the list item, or whatever other way i can force that event to execute?
    Yevgeniy Shunevych
    @YevgeniyShunevych
    Hey @cowilliams . I haven't faced such case when hover doesn't actually force element to hover. Atata uses Actions.MoveToElement under the hood to hover an element. Can't you use Click instead of Hover?
    Yevgeniy Shunevych
    @YevgeniyShunevych
    You can also try Focus control's method instead of Hover. But not sure if it will work.
    cowilliams
    @cowilliams
    The focus does work. I can get the tests running well enough with that, but just wanted to see if there was a known issue with the hover. For reference, this is the event that I'm looking to hit
    $('#Menu>ul>li').on('focusin mouseenter', function (e)
    Yevgeniy Shunevych
    @YevgeniyShunevych
    Another options is to trigger 'mouseenter' event thru JS. Here is how it is possible to implement inside custom control:
    public class SomeControl<TOwner> : Control<TOwner>
        where TOwner : PageObject<TOwner>
    {
        protected override void OnHover()
        {
            Driver.ExecuteScript("var mouseenterEvent = document.createEvent('MouseEvents'); mouseenterEvent.initEvent('mouseenter', true, true); arguments[0].dispatchEvent(mouseenterEvent);", Scope);
        }
    }
    BraneXZ
    @BraneXZ

    Hi, I am having issues on navigation. Currently, the website has a navigation bar, each containing its own list of items. However, <div> for those items would only show up on mouse hovers. I have something like this,

    public class Header<TOwner> :
        Control<TOwner>
        where TOwner : Page<TOwner>
        {
            public class HeaderMenu:
                Control<TOwner>
            {
                [FindByXPath("/div/nav/span/ul/li[1]")]
                public Menu1<TOwner> Example1 { get; set;}
            }
            [FindByXPath("//*[contains(@class,'BottomHeaderRow')]")]
            public HeaderMenu Menu {get; set;}
        }
    
    public class Menu1<TOwner> :
        Control<TOwner>
        where TOwner : PageObject<TOwner>
        {
            [FindByXPath("//a[@href='/example1']")]
            public Link<Page1, TOwner> ToPage1 {get; set;}
    
            [FindByXPath("//a[@href='/example2']")]
            public Link<Page2, TOwner> ToPage2{get; set;}
        }

    And I call it by using
    Header.Menu.Menu1.Hover().Header.Menu.Menu1.Click()
    But I am currently getting a NoSuchElementException : Unable to located element: By.XPath error. I was able to locate the item directly from the web page using the XPath but somehow unable to with this method.

    Yevgeniy Shunevych
    @YevgeniyShunevych

    Hey. The first thing I see that might be wrong is XPath:

    [FindByXPath("/div/nav/span/ul/li[1]")]
    public Menu1<TOwner> Example1 { get; set;}`

    Don't use single slash at the beggining of XPath. Use either //, .// or ./.

    You can also take a look at HoverParent trigger that can do hovering automatically.

    Yevgeniy Shunevych
    @YevgeniyShunevych
    New Atata example: Take Screenshot
    BraneXZ
    @BraneXZ

    Thanks! I was able to resolve that issue but now I'm facing another ): I have a select property and my test would randomizes the option I get from that select. Is there a way to use

    property.SetRandom()

    so that it will set to a random option from the list? And I didn't want to create a Enum for the property because the list of options might change over time and hard coding it wouldn't be ideal.

    Yevgeniy Shunevych
    @YevgeniyShunevych
    Ok, got it. You want to choose any available option of select, or one of specific predefined values?
    BraneXZ
    @BraneXZ
    Any available option of select.
    Yevgeniy Shunevych
    @YevgeniyShunevych
    OK. Will get back to you with some solution.
    Yevgeniy Shunevych
    @YevgeniyShunevych

    Hey. Implemented few extension methods for Select. You can add this class to your project:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    
    namespace Atata
    {
        public static class SelectExtensions
        {
            public static TOwner SetRandomAvailable<T, TOwner>(this Select<T, TOwner> select)
                where TOwner : PageObject<TOwner>
            {
                return select.SetRandomAvailable(filter: null);
            }
    
            public static TOwner SetRandomAvailableExcept<T, TOwner>(this Select<T, TOwner> select, params T[] exceptValues)
                where TOwner : PageObject<TOwner>
            {
                return select.SetRandomAvailable(values => values.Where(x => !exceptValues.Contains(x)));
            }
    
            public static TOwner SetRandomAvailableExceptFirst<T, TOwner>(this Select<T, TOwner> select)
                where TOwner : PageObject<TOwner>
            {
                return select.SetRandomAvailable(values => values.Skip(1));
            }
    
            public static TOwner SetRandomAvailable<T, TOwner>(this Select<T, TOwner> select, Func<IEnumerable<T>, IEnumerable<T>> filter)
                where TOwner : PageObject<TOwner>
            {
                T randomValue = select.GetRandomOptionValue(filter);
    
                return select.Set(randomValue);
            }
    
            public static T GetRandomOptionValue<T, TOwner>(this Select<T, TOwner> select, Func<IEnumerable<T>, IEnumerable<T>> filter = null)
                where TOwner : PageObject<TOwner>
            {
                IEnumerable<T> allOptionValues = select.Options.Select(x => x.Value);
    
                T[] filteredOptionValues = (filter?.Invoke(allOptionValues) ?? allOptionValues).ToArray();
    
                int indexToUse = Randomizer.GetInt(0, filteredOptionValues.Length - 1);
                return filteredOptionValues[indexToUse];
            }
        }
    }

    Usage in test:

    Go.To<SelectPage>().
        TextSelect.SetRandomAvailable().
        TextSelect.SetRandomAvailableExceptFirst().
        TextSelect.SetRandomAvailableExcept("Option B");

    I will later think how to move this thing to Atata itself.

    BraneXZ
    @BraneXZ
    It worked out awesomely! Thanks for the quick response and help!
    Yevgeniy Shunevych
    @YevgeniyShunevych
    Always welcome.
    Yevgeniy Shunevych
    @YevgeniyShunevych
    Yevgeniy Shunevych
    @YevgeniyShunevych
    Dmitry Romashov
    @FrameBassman
    Hi guys
    Nice tool)
    Yevgeniy Shunevych
    @YevgeniyShunevych
    Yevgeniy Shunevych
    @YevgeniyShunevych
    Atata.KendoUI 1.1.0 is released with new KendoDatePicker control
    Yevgeniy Shunevych
    @YevgeniyShunevych
    Atata 1.3.0 is released with aggregate (multiple) assertion functionality
    Yevgeniy Shunevych
    @YevgeniyShunevych
    Atata Templates 1.3.0 Visual Studio extension is released with few enhancements and update of package references
    Yevgeniy Shunevych
    @YevgeniyShunevych
    Atata.Configuration.Json 1.2.0 is released with support of new Atata configuration properties