I would like to copy the second word which, of course, is “hold.”
Or imagine that same text box, with the following text,
When in the course of human events…
In that case, I would like to copy the second word which, you can see, is “in.”
I am sorry for asking such a simple question but hours of searching and trying different approaches has been fruitless.
I’m using Katalon Recorder in Firefox 78.0.1 on Linux.
I doubt it matters, but I can successfully move the cursor to the very beginning of the text box which contains the text in which I would like to copy the second word. However, I don’t know how to copy the second word.
I’m neither a developer nor a QA guy. I am merely a “power user”, that is, I am not very technical at all. Therefore, because “when you are hammer, every problem looks like a nail” I was thinking of a kludge, which I realize might seem ridiculous to you guys, such as…
Ctrl+Right_Arrow (to move to the end of the first word)
Right_Arrow (to move past the space between the first word and the second word)
Shift+Ctrl+Right_Arrow (to select the second word)
I don’t use Katalon Recorder, so you will have to judge if I am helpful or not, however, what I would use is the String function, split(" "). (There is a space between the quotes.) What split does is separate a string into parts. In this case, the parts are whole words.
stext = textboxtext.split(" ")[1]
Now, split starts the first word at 0, the second word would be 1. Now you have to figure out how to use it in Recorder context (if it can be).
Or if You want to copy to clipboard just search google for “javascript copy to clipboard” and you will have ready to use examples and then just use one of this in Katalon Recorder with “runScript” command
How can I cause secondWord to eventually end up in a spreadsheet?
Frankly, I have just about solved my problem—albeit inelegantly—by kludging togetherer Katalon Recorder and a couple of Python scripts (each of which calls a couple of bash scripts) which I execute with a hotkey via AutoKey. But, as I’m sure you know, remarkably kludgy solutions like this tend to break. And frankly, I barely know how to use Python.
Therefore, I’m not sure if I would be able to fix my solution if it were to break. Of course, I would rather have a more elegant solution instead of this Rube Goldberg contraption I have reluctantly fashioned out of necessity.
I suppose ideally, I’d like Katalon recorder append the value of secondWord to a text file which I could later manually import into a spreadsheet such as Google Sheets or Gnumeric.
In case you want a chuckle, here’s one of my two Python scripts…
I recently start to learn python and i never used keybord or window like You did but it’s look pretty simple - there is not a lot of code and all… I think it should work just fine for a long time.
For storing values in file on your dekstop You have at least two more options:
Use Js to create and download file with your value inside.
pros: pretty easy to do with ready to use script from stackoverflow
cons: after downloading you have to manually upload file on google drive or something
this server will catch it and execute "dir"command in command prompt and return result in json format and content of page will chcange to that JSON response so you can then work with it in Katalon so it’s two way communication between Katalon Recorder and operating system (I use it on Windows 10 and it’s work really good). For longer command (address bar can handle about 2000 characters) i just write powershell script and I just execute this script with parameters.
from PowerShell (or Python - it’s should work too) I can do anything.
Some time ago i have even combine this two solutions. I have a lot of data to download so I can’t use them as parameters in URL for katalon helper so first i download them with JS and then i run PowerShell wich then work on this file.
Thanks for all of that helpful information Piotr. I really appreciate it.
I recently start to learn python and i never used keybord or window like You did but it’s look pretty simple - there is not a lot of code and all…
Yes, what I wrote is very simple.
I think it should work just fine for a long time.
Thanks but it’s a kludge. I’d rather implement an elegant solution.
For storing values in file on your dekstop You have at least two more options:
Use Js to create and download file with your value inside.
A. Pros: pretty easy to do with ready to use script from stackoverflow
B. Cons: after downloading you have to manually upload file on google drive or something
The JavaScript approach you indicatedseems promising to me because the pro you indicated seems like a big pro, yet the con you indicated seems like a trivial con. I had presumed I would need to manually import a file into a spreadsheet. Frankly, doing so would probably only take me only a couple of minutes once every week or maybe even only once a month.
What type of script should I look for on Stack Overflow?
Katalon Recorder Helper Tool
The Katalon Recorder Helper Tool requires Java Runtime Environment version 8.x be installed on my machine. I would prefer not to install JRE.