This is a migrated thread and some comments may be shown as answers.

Select a KendoReact DropDown Item Using Selenium

3 Answers 2328 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
GokuJim
Top achievements
Rank 1
GokuJim asked on 08 Oct 2019, 08:14 PM

We are attempting to create automated Selenium web driver based tests of our KendoReact based web application. Our tester is attempting to find one of the options to select using Selenium, and there does not seem to be any <option> entries available to select from in the DOM. How can we accomplish this, and via which element selector can we use?

Thanks,

Jim

SKF USA, Inc.

3 Answers, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 09 Oct 2019, 07:46 AM

Hello, James,

This is one of our tests for checking the selected value:

    'DropDownList selected value rendering': (browser) => {
        browser
            .click('.k-dropdown')
            .pause(defaultAnimationDuration)
            .click('.k-item:nth-child(2)')
            .pause(defaultAnimationDuration);

        browser.expect.element('.k-input').text.to.equal('BMW');
    },
We have many unit and e2e tests for all of our components.

What I can suggest is taking our repository with the source code and checking all of the tests we have, to see which one of them can be used as well:

https://www.telerik.com/kendo-react-ui/components/installation/source-code/

For our e2e test we use NightWatch, which is Selenium based.

Regards,
Stefan
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
GokuJim
Top achievements
Rank 1
answered on 02 Dec 2019, 05:52 PM
Thanks Stefan for the example, however, we are using the C# based Selenium library with a Chrome Selenium driver, and the syntax is a little different. We're trying to now select a TabStripTab item, and realized that we cannot put any additional HTML tags on them, as class name, id and name all are thrown out when Kendo draws the ul/li elements behind the TabStrip/TabStripTab components.
0
Stefan
Telerik team
answered on 03 Dec 2019, 07:06 AM

Hello, James,

Depending on what has to be selected there are two options:

1) Selection of the tab item. This can be done by rendering a custom title, this allows rendering a custom element that can have any attributes that are needed

https://www.telerik.com/kendo-react-ui/components/layout/api/TabStripTabProps/#toc-title (The title can be React component)

2) Selection of the tab content. This can be done by using the contentClassName as will allow setting a custom className that later can be used to select the specific tap:

https://www.telerik.com/kendo-react-ui/components/layout/api/TabStripTabProps/#toc-contentclassname

Regards,
Stefan
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
GokuJim
Top achievements
Rank 1
Answers by
Stefan
Telerik team
GokuJim
Top achievements
Rank 1
Share this question
or