Which components can be interacted with in Protractor?

The element I am attempting to engage with utilizes the ng-sortable attribute and consists of a few draggable and sort-able divs.

await viewTransaction.getEl('div#dragdrop-boundary').sendKeys(protractor.Key.ARROW_DOWN);

Failed: element not interactable

In this instance, the element is visible. Is it possible that only specific elements such as dropdowns can be affected by sendKeys in this manner?

Referencing the Documentation, which explicitly mentions a WebElement.

I am primarily questioning whether only certain WebElements are capable of being manipulated in particular ways like using protractor.Key.ARROW_DOWN?

This is some of the markup:

Note: Names of classes and variables have been changed for confidentiality purposes.

<div ng-show="sortMode.sorting" id="dragdrop-boundary" class="sortMode-high">
    <div ng-if="Transaction &amp;&amp; Transaction.TransactionId" ng-repeat="Section in Sections" class="ng-scope">
        <div ng-hide="'PICKLIST' === Section.SectionId" class="lineItem-title ng-binding">Rental</div>
            <div data-ng-model="SortableLineItems[Section.SectionId]" data-as-sortable="sortableOptions" class="ng-pristine ng-untouched ng-valid ng-scope ng-not-empty">
                <div data-as-sortable-item="" data-ng-repeat="LineItem in SortableLineItems[Section.SectionId]" class="ng-scope as-sortable-item">
                    <div as-sortable-item-handle="" class="sortMode-existing-lineitems sortMode-row sortMode-outerRow sortMode-item-enable                                             sortMode-selected" ng-class="arbitrary:LineItem.TransactionType=='SALEFEE','kit-component':LineItem.IsKitComponent,'damage-waiver':LineItem.TransactionType=='DAMAGEWAIVER',discount:!LineItem.ItemId &amp;&amp; LineItem.ItemKey.includes('Discount')}">
                        <div class="sortMode-icon-container">
                            <button class="btn-default btn btn-xs action-btn-delete ng-scope" ng-if="LineItem.ItemId && LineItem.LineItemId" disabled="">
                                <span class="roro-icon roro-icon-cancel"></span>
                            </button>
                        </div>
                        <div class="sortMode-cell sortMode-item-name ng-binding">Wagon</div>
                        <div class="sortMode-cell sortMode-item-key ng-binding ng-scope" ng-if="LineItem.HasItemKey">ITEM-3</div>
                        <div class="sortMode-cell sortMode-amount-per-item ng-binding">$30.00</div>
                        <div class="sortMode-cell sortMode-quantity ng-binding">1</div>
                        <div class="sortMode-cell sortMode-amount-text ng-binding">$30.00</div>
                        <div class="sortMode-cell sortMode-tax-free-text ng-binding">T</div>
                        <div class="clearfix line-item-instances ng-scope" ng-if="LineItem.ItemSerialized && & !RemovingItem[LineItem.LineItemId]">
                        <div ng-class="{'padding-none' : !subItemPopup[$index].active}" class="padding-none">
                            <div class="line-item-cards">
                                <div class="line-item-card tbd-card ng-scope" ng-if="LineItem.CountUnassigned"><div>
                                                        <span translate="TBD" class="ng-scope"><p>TBD</p>
                                                    </div>
                                                </div>

                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div ng-if="Transaction && Transaction.TransactionId" ng-repeat="Section in Sections" class="ng-scope">
                        <div ng-hide="'PICKLIST' === Section.SectionId" class="lineItem-title ng-binding">Damage Waiver<</div>
                            <div data-ng-model="SortableLineItems[Section.SectionId]" data-as-sortable="sortableOptions" class="ng-pristine ng-untouched ng-valid ng-scope ng-not-empty">
                                <div data-as-sortable-item="" data-ng-repeat="LineItem in SortableLineItems[Section.SectionId]" class="ng-scope as-sortable-item">
                                    <div as-sortable-item-handle="" class="sortMode-existing-lineitems sortMode-row sortMode-outerRow
                                        sortMode-item-enable
                                        sortMode-unselected" ng-class="{arbitrary:LineItem.TransactionType=='SALEFEE','kit-component':LineItem.IsKitComponent,'damage-waiver':LineItem.TransactionType=='DAMAGEWAIVER',discount:!LineItem.ItemId && & LineItem.ItemKey.includes('Discount')}">

                                        <div class="sortMode-icon-container">

                                            <button class="btn-default btn btn-xs action-btn-edit ng-scope" ng-if="LineItem.TransactionType == 'DAMAGEWAIVER'" disabled="">
                                                <span class="roro-icon roro-icon-edit"></span>
                                            </button>

                                        </div>
                                        <div class="sortMode-cell sortMode-item-name ng-binding">Damage Waiver (10%)</div>
                                       <div class="sortMode-cell sortMode-item-key ng-binding ng-scope" ng-if="LineItem.HasItemKey">N/A<div>

                                       <div class="sortMode-cell sortMode-amount-per-item ng-binding">$3.00</div>
                                           <div class="sortMode-cell sortMode-quantity ng-binding">1</div>
                                               <div class="sortMode-cell sortMode-amount-text ng-binding">$3.00</div>
                                                   <div class="sortMode-cell sortMode-tax-free-text ng-binding">T</div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

Answer №1

When you interact with a webelement by sending keys, protractor initiates a series of commands to that specific element within the DOM. Depending on the type of element, such as a text box or dropdown, the sequence of keys sent can be in the form of strings or key control commands. For instance, using a command like protractor.Key.ARROW_DOWN on a dropdown element enables the element to carry out that particular command. However, for elements like sortable items (e.g., drag and drop), the arrow key functionality may not work unless it is explicitly defined for that specific webelement. If the UI allows for selecting an element and moving it downward by pressing the arrow key, then it should work accordingly. On the other hand, actions like click-and-drag could potentially function with sendKeys, although I have yet to test this method and cannot guarantee its success.

Furthermore, when sending keys in the following manner:

await viewTransaction.getEl('div#dragdropboundary').sendKeys(protractor.Key.ARROW_DOWN);

The specified key will remain continuously pressed until a null key is sent afterward, like protractor.Key.NULL:

await viewTransaction.getEl('div#dragdropboundary').sendKeys(protractor.Key.ARROW_DOWN, protractor.Key.NULL);

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

What is the best way to perform a query in Angular using Firebase Firestore?

I am attempting to execute queries in Angular 6 using Firebase Firestore. I have this code, and I have already installed the package "npm firebase @angularfire" but it is not working: import { Component } from '@angular/core'; import { A ...

What is the process for obtaining an AccessToken from LinkedIn's API for Access Token retrieval?

We have successfully implemented the LinkedIn login API to generate authorization code and obtain access tokens through the browser. https://i.sstatic.net/0dfxd.png Click here for image description However, we are looking to transition this functionality ...

Storing WebDriver as a global variable and running a test multiple times within the same Swing instance is not permitted

Within the Swing framework, I have a JButton that triggers a specific test script when clicked on: @RunWith(Parameterized.class) public class ExampleTest{ private static csvTools csvTools = new csvTools(); private static WebDriver driver = CreateWebDrive ...

Performing a Mouse Up action in Selenium WebDriver 2 using Ruby

I need to activate a jQuery dropdown using Selenium. I discovered that MouseUp[xpath=//a[contains(text(),'itemname')] works in IDE, but I am struggling to replicate this functionality in Ruby WebDriver. Can the actions class be used to achieve ...

Is it possible to download a single file into multiple folders using Webdriver in Java?

My objective is to download a file in 4 different locations using the code below. Currently, the file is being saved in the default Downloads folder. System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir") + "/src/Brows ...

Troubleshooting the problem of redirecting a website to www on IIS 10 (Windows Server 2019)

I have a React website running on port 3000. Currently, the website can be accessed with and without the www prefix, causing duplicate SEO issues. I want to ensure that the website always redirects to https://www.pess.org.ua. web.config <?xml version=& ...

What strategies can I employ to ensure that my python selenium script continues to function effectively even when minimized

I'm currently working on a Python script that reads data from an input file named input_names.csv. This file contains a list of names and zip codes. The purpose of this script is to utilize this information to open up Google Chrome with Selenium, mini ...

Is there a way to access a console or log in phantomjs to monitor internal processes and activities?

Do you ever drive from python to selenium and find the journey quite amusing? When using phantom, the non-visual web browser, we often feel like we're in the dark during testing. This leaves us wondering: Is there a log generated by phantom that we ...

Angular 7 is throwing an error message that reads: "Module not found: 'AppModule'"

When running ng build, an error occurs without providing any specific details like the file name. This project is an ASP.NET Core app with Angular 7. c:\Users\siva\Myapp\ClientApp>ng build Date: 2019-08-08T13:22:52.205Z Hash: 3cf960 ...

The error message "webdriver.chrome() TypeError: 'module' object is not callable" indicates that there is an issue

I have been developing a python3 script for web scraping on Amazon using selenium. However, I encountered this error during debugging: webdriver.chrome() TypeError: 'module' object is not callable I tried changing 'chrome' to 'Ch ...

Updating and Preserving Content in Angular

I've encountered an issue while working on a code that allows users to edit and save a paragraph on the screen. Currently, the editing functionality is working fine and the save() operation is successful. However, after saving, the edited paragraph do ...

Definition of a class in Typescript when used as a property of an object

Currently working on a brief .d.ts for this library, but encountered an issue with the following: class Issuer { constructor(metadata) { // ... const self = this; Object.defineProperty(this, 'Client', { va ...

Exploring a JSON object using PlaywrightWould you like to know how

Greetings! Here is a snippet of code that I have, which initiates an API call to a specific URL. const [response] = await Promise.all([ page.waitForResponse(res => res.status() ==200 && res.url() == & ...

Unleashing the power of TypeScript with Solid JS Abstract Class

Why am I getting an undefined error for my calcUtilisation method when using an Abstract Class as the type in createStore? Is there a way to utilize a type for the data along with a method within the same class for createStore? abstract class Account { ...

Error message: "Vue3 JSX files are throwing a ReferenceError because React is not defined."

Currently, I am working on integrating storybook with antdv. However, when importing a tsx file that contains jsx within the button.stories.js file, I encountered an error stating "ReferenceError: React is not defined". You can view the error here. It is i ...

Trying to enter the function, but it exits without executing

I'm facing an issue with my function that involves making multiple calls to an observer. I need the function to wait until all the calls are complete before returning. I attempted putting the return statement inside the subscribe method, but it result ...

c# selenium code to interact with submit button element

Is there a way to extract text from an input box? <input value="Add a Phone" onclick="CSS.addClass($(&quot;u_0_4&quot;), &quot;async_saving&quot;); new AsyncRequest().setURI(&quot;\/ajax\/phone\/confirma ...

JavaScript and Angular are used to define class level variables

Hello, I'm currently diving into Angular and have encountered an issue with a class level variable called moratoriumID in my component. I have a method that makes a POST request and assigns the returned number to moratoriumID. Everything seems to work ...

How can I search multiple columns in Supabase using JavaScript for full text search functionality?

I've experimented with various symbols in an attempt to separate columns, such as ||, |, &&, and & with different spacing variations. For example .textSearch("username, title, description", "..."); .textSearch("username|title|description", "..."); U ...

Unable to locate the "fcm-node" module in Node.js with TypeScript

When working on a TypeScript project, I usually rely on the fcm-node package to send Firebase push notifications in Node.js. However, this time around, I faced an issue. I know that for TypeScript projects, we also need to install type definitions (@types ...