2/14/2024 0 Comments 10 fats typing fingers![]() Refactoring is a great way to learn more about the structure of a script, and understand how it works. How would you refactor this? It’s likely that opening a browser, going to a url are going to be common across all kinds of web UI scripts. ![]() How can you make this go faster? What about using different browser? How high a rate can you get? ![]() # all done! finish up and close out the browser instance # type the word followed by a space, so the site picks up that you typed a word # this is how the site tells when you enter a word. # type in the text of the word followed by a space. $b.text_field(:xpath => iterate through each available word. $b.element(:xpath => when the input field is visible, click it so that you can start typing into it # wait for the words to actually show up on the screen before doing anything else # go straight to the english typing test, saves time. Then once we have all this support code set up, we can write the script: # setup the browser instance We’ll also need a function to close out the browser when the script is done, otherwise you’ll have a browser window open every time you run the script: def teardown We need a thread spun up to actually load the link we want to go to, and to shut down the thread when done: def go_to_url(url) Once we open a browser, we need a place to go. $b = Watir::Browser.new :chrome, :http_client => client # $b = Watir::Browser.new :ff, :http_client => client # set up the $b component with the info here. If you want to dig in and figure out how it works, be my guest, but it’s kind of out of scope of this article: def setupĬlient = Selenium::WebDriver::Remote::Http::Default.new Next we need a function that opens up a browser window and hooks the Watir session to it. Below is just some boiler plate code that I’ve been using for years. From here down, put all the code sections into the same script, in the order they’re presented.įirst we need to tell the script which Ruby gems to use: require "rubygems" So do the same Inspect Element operation on the text field below, and see what can be identified about it: Next, we need to find out where to actually type the word. So a locator for these words can be found by searching for the following XPath: particular XPath will give you multiple hits, which is fine, because Ruby allows you to iterate through a list of items and act on each one. Right-click on the first highlighted word and click “Inspect Element” in Chrome or Firefox. We first need to know how to tell what word to have the script type. There’s a structure to this page that will need to be known before automating. When you have finished a test, start up another one and let’s take a look at the guts of what’s going on with this page. Every time you type a word, and hit the space bar, the next word will highlight. Or automate it.įirst let’s head over to the site itself,, and click the “Start a Typing Test” button at the bottom. Plus it saves my fingers some wear-and-tear, and instead of typing here, I can type on a typing test. I won’t be digging into details much about really small details, like figuring out how to locate an element–I’m just going to put the locator in there, with minimal explanation, because I know you’re smart people and can learn more by just grabbing the code and fooling with it, than any amount of talking I do. Today I’m going to walk through a script that automates an online typing test, using that toolset. Try it once to memorize the keyboard for Hindi typing.For UI automation as a hobby, I tend to use Ruby and Watir. It also has a digital keyboard for your convenience. Hindi keyboard is very easy to remember with 10 Fast Finger Typing Game and you can type without looking at the keyboard. You can also join the easiest and best course from the Stenoguru website for free to learn Hindi typing. In the future, it will be presented in other languages also. This game is available in both Hindi and English language. This game will definitely make you fluent in typing speed and online typing test in Hindi. Stenoguru has created many interesting games like this. This game also shows your score and also gives the detail of a number of mistakes. You have to type the letters flying from top to bottom. You can also set the speed of the game as you wish. Start it by clicking on the start button. ![]() This game is very interesting and lets you practice typing while playing. In 10 Fast Finger Typing Game, you can practice memorizing the Hindi Krutidev keyboard. Typing without looking at the keyboard only increases the typing speed.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |