When it comes to Se Web Driver Tests, SCSS dominates the way text is rendered

After resolving the issue, I discovered that using XPath fixed it. However, figuring out where to make the fix and understanding why it needed to be done was a challenge when inspecting Dev Tools. In the following slides, I documented the data trail I followed and highlighted the gaps in my knowledge that were filled along the way.

I encountered confusion when attempting to modify the text in ng-reflect-model, which is where text entered into the textbox is stored:

https://i.sstatic.net/mP1qt8Ds.png

By closely reading this link about Selenium with Kendo UI, I took a leap of faith to explore the nested input within kendo-textbox below the span element. This led me to figure out the following x-path:

https://i.sstatic.net/2f1c79hM.png

Inspecting the form via Dev Tools and trying to piece everything together can quickly become overwhelming. There seems to be some Angular directive technology at play here, and trusting that 'The Kendo Team has this!' was a realization I had. Although the input element does not display the input, targeting it in the test will work.

================ New Content 21 Nov 13:35 =============

At 5:45 PM, I came across this Stack Overflow post: Selenium with Kendo UI

Is writing xpath the 'hard way' in C# using Se Web Driver the only option for this? The post is six years old - isn't there a better approach available?

I also posted this on the Kendo Textbox forum, hoping for an easier solution than running tests, letting them fail, mapping out x-paths, and repeating the process until success.

==================== Above New info as of 5:45 20 Nov =====================

When the test runs, the first name appears incorrectly due to no entry on the left, causing the error icon to show up. The first name should actually be in the

https://i.sstatic.net/FQZjNIVo.png

After running the test, I manually typed the text in the correct place myself.

https://i.sstatic.net/QX1xMDnZ.png

This is where the test should be placing the text. I'm unsure where the span.k-input-suffix comes from. Searching through the Visual Studio solution doesn't yield any results for such a class. When searching for span.k, many entries are found, none of which match the shown class.

Here is the code for the test:

        public class SeleniumCourseWebDriverTests
{
    [Fact]
    public void SimpleDoITWebDriverTests()
    {
        var driver = new EdgeDriver();
        driver.Manage().Window.Size = new Size(1200, 1087);
        driver.Navigate().GoToUrl("http://localhost:5000/login?returnUrl=%2Fhome");
        driver.FindElement(By.CssSelector(".flexbox-container")).Click();
        driver.FindElement(By.CssSelector(".btn")).Click();
        driver.FindElement(By.Id("WindowsAuthentication")).Click();
        driver.FindElement(By.Name("Recognize a Team Member")).Click();
        driver.FindElement(By.LinkText("Award Submission")).Click();
        driver.FindElement(By.Id("shouterFirstName")).Click();
        driver.FindElement(By.Name("First Name")).SendKeys("Michael");
        driver.FindElement(By.Id("shouterLastName")).Click();
        driver.FindElement(By.Id("shouterLastName")).SendKeys("Durthaler");

Text areas involve complex SCSS but function correctly:

https://i.sstatic.net/6LzqYDBM.png

These are the two lines of code for the text area:

            driver.FindElement(By.Id("awardCommentsText")).Click();
        driver.FindElement(By.Id("awardCommentsText")).SendKeys("Ian was a great help figuring out why my courses in my Edge browser were freezing up.");

It seems that SCSS takes control over text boxes and generates classes mysteriously, making them untraceable for some reason.

Here is the HTML for the First Name text box:

        <div class="col-md">
  <kendo-label text="First Name">
    <kendo-textbox
                   name="First Name"
                   id="shouterFirstName"
                   contenteditable="true"
                   >

    </kendo-textbox>
  </kendo-label>
</div>

This is the HTML for the comments text area, where rendering works:

    <div col-md>
  <kendo-label
               id="awardtext"
               [for]="awardtext"
               text="Comments">
  </kendo-label>
  <textarea kendoTextArea #awardtext id="awardCommentsText" contenteditable="true"> </textarea>
</div>

I'm unsure where the extra

If more information is needed or if further clarification is required, please let me know and I'll do my best to explain.

Additional information that may be helpful: The text appears crammed into the right end of text boxes in mysterious spans, where validation indicators are displayed.

The red outlines indicate that the form was typed correctly, while the checkmark signifies entries of a specific length. If there's no entry, a red exclamation mark appears instead of the checkmark.

During the Se test, even though ids are set for where the text should be displayed, the test locates where the validators reside and places the text inside their spans. The same issue occurs with the date picker, where the date string gets placed next to the calendar icon instead of inside the input field.

SCSS seems to determine that the text belongs in these locations and moves them accordingly. Maybe this insight could provide a new perspective for those observing this situation?

It's a peculiar scenario that requires us to step back and acknowledge that "Computers do what they're instructed to do, and only that." We must gather clues and understand the reasoning behind the behaviors. Thank you once again for any insights provided.

https://i.sstatic.net/kEoEXITb.png

Answer №1

Take a look at the latest notes posted above. It's important not to get too caught up in the technical details of Angular. It can be easy to get distracted by all the interesting things happening in the F12 Inspect window!

Even though the text wasn't appearing as I typed, it was being captured in the ng-reflect-model just above the input.

I wasn't sure if using x-path would solve the issue since the input wasn't displaying the text I typed. However, Telerik / Kendo has already implemented angular directive technology. Trust their expertise and experience in this area.

I hope this information is helpful for those navigating Se Tests. Consider reaching out to the Kendo team for additional guidance to enhance your understanding.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips for creating a JavaScript class that can be easily used in various projects

I've been working with this code where I always have to create the const ctx at the beginning of the document with the same name used in the class. I'm curious if there's a way to make this class more adaptable for other projects. const canv ...

Cleaning Data-* Attributes with Jsoup Whitelist Sanitizer

Using the jsoup whitelist sanitizer to sanitize html before serializing (json) and ajaxing it. Is there a way to permit all data-* attributes in html without having to manually add each instance to the whitelist? ...

Exploring the functionality of multiple index pages in angularjs

I am trying to access the localhost:3000/admin which is located in my views. The index.html and admin.html are two separate base files, one for users and the other for the admin dashboard respectively. Here is a snippet from my app.routes.js file: angul ...

Having difficulty shrinking the excessive gap between the image and text

https://i.sstatic.net/7Wu8J.jpg I have created an app and added inline styling to make the image and text appear next to each other. However, there seems to be some extra space between the image and text, and the text "Demo Analysis Application" is split ...

Tips for creating a WebDriverWait for when the content of a webpage changes asynchronously, without the need for a page reload

Currently, I am working on a test using Selenium Webdriver in Java, and the driver I'm utilizing is from https://cloud.google.com. To begin, I locate the search input field and use sendKeys("search phrase \n"). As the page content starts to chang ...

Leveraging the power of Required (html5) feature in Internet Explorer

What should I do if I want to make a textbox required on my webpage, but the issue is that it uses an HTML5 attribute? Is there a solution or alternative available? This is how I create my TextBox: @Html.TextBoxFor(model => model.SubChoiceText, new { ...

Inquiry about Tree Traversal in Javascript using Jquery

Consider the following scenario: <ul> <li>Item 1</li> <li>Item 2 <ul> <li>Sub Item</li> </ul> </li> <li>Item 3</li> </ul> This list is dynamically generated by another piec ...

Tips on maximizing the file size limit of the fileupload control in asp.net

I am trying to determine the file size limit for my file upload control. Below is the HTML code snippet: <input id="uplTheFile" style="WIDTH: 318px; HEIGHT: 22px" type="file" size="80" name="uplTheFile" runat="server"> I have checked the code but ...

reduce input to 2 characters using jQuery

Is there a way to trim the input text down to just the first two characters when a button is clicked? For example, if I enter "BT2J43" into the input field, can it be automatically shortened to "BT" upon clicking the button? I'm new to learning jQue ...

Discover the current style being applied using JavaScript

After taking a look at this particular post on Stack Overflow about How to retrieve the background color of an element using javascript? I discovered that by using div.style.color You can access the color applied to the div element. However, it seems ...

grab the content from a text editor and insert it into a div element

Currently, I am trying to extract text from my content editable div and place it in another div (similar to the one seen on stack overflow). However, I am encountering a frustrating issue. 1. My content div seems to be lagging behind. When I type in my ed ...

Image unveiling upon hover effect

I am looking to create an on-hover display feature for the products on my website. Initially, I considered using the show/hide jQuery function. Then, I thought that utilizing arrays might be a better approach, but unfortunately, I have very little knowledg ...

Capturing HTML String with Html2Canvas

What is the proper way to input a valid HTML String into html2canvas? For example: var html = "<html><head></head><body><p>HI</p></body></html> This method can be seen in action on While Html2canvas is a ...

Struggle with typescript integration with emotion and styled components

Issue Description: I encountered an issue while working with typescript and emotion/styled libraries. When attempting to specify the type of the parent component that wraps a styled component, I faced difficulties. The scenario involves a parent componen ...

Issues with Selenium Webdriver in Google Chrome can occasionally result in browser hang-ups

I have encountered an issue while using Selenium in a Python application. I have written a simple code that opens a headless browser, selects the Chrome profile, and extracts the OAuth2 code from the URL. The code generally works well, but occasionally it ...

Is it feasible to decrease the lateral margins of Bootstrap's container without the need for custom CSS? If so, what is the method?

My web page includes several screenshots to illustrate the issue I am facing. One of my challenges is the scroll bar below the table, which I find displeasing. In an attempt to resolve this, I decided to adjust the lateral margins slightly. Here's a s ...

Experience smooth scrolling by utilizing page scrolling instead of div elements in React programming

Looking for help with my web resume that I am building using react. The parent div is set up like this - <div className={`w-100 d-flex flex-column align-items-center m-0 position-absolute ${styles.container} `} > I have multiple chil ...

Learning to detect the end of a Youtube video using Selenium in Python

[Edit: issue resolved, check midway through question] I have a quick inquiry about understanding the content of a Youtube page while a video is playing on it: To Summarize My approach involves using Selenium to play videos on Youtube within a browser-ba ...

Preventing Copy and Paste function in WKWebView - A Guide

I am seeking a solution to deactivate the callout menu that appears when an element is long-tapped in a web view: https://i.sstatic.net/TiWsY.png Despite various answers available, like this one, none seem to be effective. It's unclear whether the t ...

Express.js with Node.js - Configuring Stylus Middleware for src and dest paths

Despite the presence of other questions about 'Stylus Middleware,' I am still struggling to understand it. I want to compile a .styl file every time I run node app.js var express = require('express'); var stylus = require('stylus ...