SeleniumLibrary icon indicating copy to clipboard operation
SeleniumLibrary copied to clipboard

Clearing text doesn't work on macos

Open luke-h1 opened this issue 3 years ago • 1 comments

Prerequisites

  • I have searched for similar issues in open tickets and cannot find a duplicate. ✅
  • The issue still exists against the latest released version of SeleniumLibrary. ✅
  • This is not a usage question or support request. For those, see more details in README.rst: https://github.com/robotframework/SeleniumLibrary#support ✅
  • You are not using the Java Selenium2Library: https://github.com/MarketSquare/robotframework-seleniumlibrary-java ✅
  • Remember that this is a public forum, so remember to remove all sensitive information, like username and password. ✅

For issues

Steps to reproduce the issue

I've created a reproduction here however it's reproducible on any mac when trying to clear text nodes using press keys

Error messages and additional information

It seems that when I use the Selenium keyword press keys to clear a text node, it doesn't work on mac OS. It works fine on Linux & Windows. When I try to use Clear Element Text or Selenium's method .clear(), it doesn't work. I've attached a repository that shows this behavior & highlights the problem I've been seeing. As long as you're on Mac OS, the repository reproduction should show the error I've been dealing with.

Expected behavior and actual behavior

When I follow those steps, I see... The browser seems to press COMMAND+ALT+BACKSPACE but doesn't clear the text

I was expecting...

The browser clears the text but it doesn't

Environment

Browser: Chrome 103 + Browser driver: Chromedriver v107 Operating System: macOS Ventura Libraries

  • Robot Framework: 6.0.0
  • Selenium: 6.0
  • SeleniumLibrary: 6.0
  • Interpreter: Python 3.10

luke-h1 avatar Nov 18 '22 18:11 luke-h1

Is there an update on this issue?

luke-h1 avatar Dec 22 '22 17:12 luke-h1

Reviewing this issue and the code to reproduce, the keystrokes, as written with combined select all and backspace to delete won't perform the expected action. Instead one should separate those two keystrokes, as in

user presses keys COMMAND+a BACKSPACE

using the provided sample code. Or if running the library's test suite

Press Keys To Delete Text
    [Setup]    Go To Page "forms/prefilled_email_form.html"
    ${text}=  Get Property    comment   value
    Should Be Equal    ${text}    Prefilled text area
    Press Keys                comment    COMMAND+A  BACKSPACE
    ${text}=  Get Property    comment   value
    Should Be Equal   ${text}  ${EMPTY}

Note as this is a text area element to see the change in text value we use the elements value property.

emanlove avatar Dec 29 '24 23:12 emanlove

Closing issue as such.

emanlove avatar Dec 29 '24 23:12 emanlove