Using browser.title to confirm EXACT text - browser

I want to confirm the exact text that appears on the browser tab.
Using "#{browser.title.include? 'Awards'} Awards tab titled 'Awards'" only confirms that the word 'Awards' appears in the browser title.
Is there a browser.title.exact? (or something similar) I can use to confirm that ONLY the word 'Awards' is the ONLY word in the browser title?

browser.title simply returns a string. To do an exact match use the == operator:
browser.title == 'Awards'
If you want it more methody looking, you can also do:
browser.title.eql?('Awards')

Related

Script to paste a specific string into a text field with a hotkey

I am trying to find a way to paste a predefined string upon entering a specific keyboard sequence, on any app.
For example if I have to paste an url or a password into a field, I can have said password in a hidden script and when I press, say, [ctrl] + [5], it would write "example123" on the text field where my cursor is.
Ideally without copying to the clipboard (I'd prefer keeping what I have on my clipboard and also avoiding to paste a password or such by mistake elsewhere).
I have tried every solution I've found so far that include xclip, xdotool and xvkdb. All of them either do not work or are really inconsistent: They only paste the string sometimes, and when they do, it's usually only part of the string ("ample123" instead of "example123").
I thought of using compose key, which I heavily use anyway to write in french on an us keyboard, but it seems it only supports 1 character sequences, as nothing is printed when I modify my .XCompose to include custom output sequences of len > 1.
I am using Ubuntu 18.04 with Gnome as a DE. Ideally something that also works when logging back (like compose keys).
You need to walk the Document Object Model for either Gnome or your web-page. My concern is that with a desktop script you wont be able to access the web page because you will need to be able to establish a target to send string to. I see in your question that you tried using using "x{tool-name}" to grab the text field element. Delivering the sting really isn't the problem. The problem is getting the GUI element of text box pragmatically. The easiest way to get access to this in a user loaded web-page is with WebExtensions API which is how to make extensions for most modern browsers. Otherwise, if you can get away with only having access to Gnome's GUI I would try LDTP, it's a library used for testing, but it looks like it can be used for automation too.
For keyboard shortcuts:
It really shouldn't matter what the script is doing to how you want to activate it. I would just go to Gnome/Settings/Keyboard and set the path to where I saved the script to be the Command. If you go the WebExtension route, you will want to build the shortcut into your extension.

Excel HYPERLINK() function seemingly broken by hash character "#"

=HYPERLINK("file:///C:/Users/dholstei/projects/xmtr%20DB/data_sheet-Instructions.htm#TestDataSheet", "help")
in Excel resolves to
file:///C:/Users/dholstei/projects/xmtr%20DB/data_sheet-Instructions.htm
in the web browser
Interestingly, hovering over the link gives a small pop-up that shows the correct, full target. Variations on that, like concatenating the subsection to the path of a root document don't work either, the subsection is stripped.
The pound sign is a valid character to use in a file name but is not accepted in hyperlinks in Office documents.

Sublime text multiple cursors?

Sublime Text is so damn advanced and this seems like such a stupid question, but...
I started writing a for loop in PHP (using SFTP), loved that it gave me a choice to auto-generate the loop. However, it enters this weird multi-cursor mode, which
1)I am not really sure how to use/exit without using the mouse;
2) it seems useless, seeing as all 3 type the same thing, even though I need to change, for example, the $i > x or $i = x.
Although Sublime does indeed support the idea of multiple cursors (which is an incredible time saver and useful as all get out, as we're about to see), what you're actually asking about here is a snippet which in this case happens to also include multiple cursors.
The general idea is that for code that you're likely to type many times (e.g. a for loop), you can create a snippet that will generate the bulk of the text for you in one shot, and then allow you to easily customize it as needed. In this case, the snippet in question is part of the default functionality of Sublime and is provided by the shipped PHP package.
To answer point #2 in your question first, this is far from useless. As seen here, I enter the text for and then press Tab to expand the snippet out. The first thing to notice here is that the status line says Field 1 of 4 to tell me that I'm in a snippet and that it contains four fields.
The first field is the name of the control variable for the loop, and all of them are selected so that as I change the name, all of them change at the same time because when there are multiple cursors, the text you type appears at all of them at the same time.
Once I'm done changing the name of the variable, I press Tab again to go to the next field, which allows me to easily change the point at which the loop starts. Another press of Tab takes me to the third field, where I can specify where the loop ends.
One last press of Tab exits the snippet and selects the text in the loop, so I can start writing my code (caveat: I am not a PHP developer).
At this point you can see Sublime offering another snippet for echo, which would expand out to an echo statement complete with quotes, then allow me to edit the text in the echo and skip to the end.
Circling back around to the first point in your question, you can use Esc at any point to jump out of a snippet and go back to regular editing. You can also use Tab or Shift+Tab to move through the fields in the snippet, and pressing Tab at the last field in the snippet exits it as well.
In this particular case, the first field in the snippet sets up multiple cursors, and so exiting the snippet while this field is active leaves multiple cursors in effect. You can jump back to a single cursor by pressing Esc one more time (this is true regardless of how you ended up with multiple cursors).

Azure Search result highlight snippets

I am using the Hit Highlighting feature in Azure Search and noticed a discrepancy in the way it behaves from the documentation. In the documentation it says that when you use hit highlighting it will return a snippet of the field with the highlight, but it always returns the entire field (with proper highlighting).
Is there a way to have Azure Search instead return just a snippet (say of about 200 characters) that includes the highlight?
Currently, the answer is no, you cannot. The field breaks according to (English) sentence rules, ie. it breaks on ".", "!", "?".
Also see this question for an example on breaking and some more info relating to the delimiters.
Depending on the nature of the field you might be able to add one of the above delimiters to 'emulate' what you want to accomplish (as suggested by Nate Ko).
I want to suggest something else on top of what Nate spoke to. When you look at the document response, also take a look at the Highlights part of the results (as opposed to the Document). For example, you might be currently getting the field results by retrieving something like this:
Results[i].Document.DESCRIPTION
If there is a highlight found for that field, the snipped will be found here:
Results[i].Highlights.DESCRIPTION
What I like to do is to first check if there is a valid Highlight and if so display it. If not, I show the actual field content.
Liam
We recently introduced a change that improves the highlighter performance on large fields and NLP experience. One side effect of the change was that the new highlighter generates snippets based on sentences, breaking the text field on '.' (period).
One way to workaround the issue is to put '.'s in the field. We are working to enforce the snippet size and let you know when it is available.

AutoCAD displays `question mark` instead of tab character when using AutoLISP

Software: AutoCAD 2012 (Japanese language)
System: MS Windows 7 (Japanese language)
I have made a .LSP file which defines a new function "C:MAKEATABLE".
I am trying to print a string which contains a tab character, using AutoLISP. But that character shows up as a question mark (?).
If I manually try to edit it (by double-clicking it, or using DDEDIT, or by TEXTEDIT ) it automatically gets converted to the tab character, which I require.
I don`t know which character encoding is being used (if that is causing a problem).
The font being used is "txt.shx".
Things I have tried:
Used (chr 9) in concatenation with the rest of the string => still shows up as a question mark
tried to print the two parts of string (on either side of the tab) separately => not good, since I need that text as a single object
tried using "DDEDIT" function in the code => It requires the user to press enter at its every invocation, so not good.
I tried simulatinging the enter key using " " , "" , ";" , (terpri). Nothing works, it still prompts the user to select another object.
tried using "TEXTEDIT" function in the code => doesn`t do anything; says that," MAKEATABLE Unknown command "MAKEATABLE". Press F1 for help."
ran the same code on my English language PC and English version of AutoCAD 2012 => same problem if i use any of the .SHX fonts; but works fine if I use the other fonts like "Arial"
I might have missed a thing or two, so please let me know if any other information is required.
Perhaps a different approach:
Isn't your problem that you are trying to create a "SingleLine text" object in AutoCAD. These do not support TABs. You could try to use the "Multline Text" object instead.
Cheers,
Alain

Resources