Struggling with text selection using Protractor here.
Providing some background; working on an AngularJS CMS system for composing news articles. The text to be highlighted is within a textarea that occupies most of the page, similar to a Google Docs Document.
For webdriver, it seems like I can simply do this:
browser.actions().keyDown(protractor.Key.CTRL).sendKeys('a').perform();
However, being on a MAC, I face issues as our end goal is to transition to using MAC for testing, currently running tests on a windows box in SauceLabs.
I attempted a similar approach using Command (or CMD) key but encountered problems since, as per this post, OSX does not support native key events.
Here are some other methods I have tried:
Tried triple clicking inside the element to select all text...but couldn't get it to work. It's challenging as the mouse cursor needs to be positioned over the text for proper highlighting.
Double-clicked within the field which, on my local machine, selects the last word in the textarea. However, in SauceLabs, due to smaller browser size, it selects a different word. This method appears fragile given variations across machines.
Attempting to move the text cursor to either the start or end of the textarea, holding down Shift and pressing left or right arrow keys based on character count. Struggling with moving the cursor in this implementation.
Appreciate you taking the time to read through this! If you have any suggestions I haven't considered yet or insights into coding the triple click or arrow keys method, it would be immensely valuable!