seleniumIDE - how to store a hyperlinks address and then visit that URL? Was working before - selenium

I had this working fine a couple of months ago but now when I run the test it fails and I don't know why or how to fix.
Background:
I have a screen with several links so that the 'admin' user who is currently logged in can login as one of the 'practitioners' via the login hyperlink presented.
Details:
So for my test I click on the 'Login link' hyperlink(s), enter & confirm a new password as required, and then I get to the practitioners screen 'as them'. The 'wrinkle' was that the pop-up for the user to enter their (new) password happened on a new window that the selenium IDE used was a new window. So basically just clicking on the hyperlink didn't work. To get around this I was able to store the hyperlink's href -a#href- in a selenium variable first_login_link_to and then use open instead of clickAndWait to visit the page, i.e. open ${first_login_link_to}
This was working fine a few months ago.... but it is not working now.
I get page doesn't exist and when I look at the url - urgh! It somehow includes the locator stuff and I am getting
http://dmplanning-stage.herokuapp.com//tr[td[contains(.,'6 Day')]][1]/td[8]/a#href
instead of
http://dmplanning-stage.herokuapp.com/p/zaH7m3aL7fxuPLvrc21L
in the browsers url address bar.
How can I get selenium to open the url stored in the variable and not use that 'locator' address?
selenium:
open /admin
clickAndWait link=practitioners
store //tr[td[contains(.,'6 Day')]][1]/td[8]/a#href
open ${first_login_link_to}

Found it - whew! Somehow my storeAttribute got changed to plain store.
Once I changed it back everything worked again!

This one worked for me
1-
Command = Store
Target = stuff you want to paste
Value = Var
2-
Command = sendkeys
Target = id for area where u wana paste
Value = ${Var}
3-
Command = Fireevent
Target = id for area where u wanna paste
Value = paste

Related

Access to a pop-up in selenium

I do have the following code to click a Google button that open a pop-up and then it selects the second Item. It worked fine but now is failing, I guess that due to ID name changed. I do not remember how I Inpectioned the pop-up ID since it does not appears in the "Inpection" Chrome Window.
numOpiniones.click()
self.driver.find_element(By.XPATH,"//button[#data-value='Ordenar']").click()
sleep(random.uniform(1, 1.5))
self.driver.find_element(By.XPATH, "//li[#role='menuitemradio' and #data-index='1']").click()
"menuitemradio" does not exists anymore but I can not see that element in the inspector panel when is created/displayed.
enter image description here
You can use the following css path
driver.find_element(By.CSS_SELECTOR, '#hovercard > #action-menu > [data-index="1"]')

AppleScript - accentued characters

I have problem with special characters in AppleScript (service in Automator).
The selected text (title of a book) is the input (titre in the script), and the goal is to display in safari the result of the advanced research of this book on noosfere.org
It's ok when there is no accent characters in my selected text.
But if titre is sphère d'influence :
In the display box (only used for testing), "sphère d'influence" is correctly written with the "è".
But in safari, in the research field in the website, I have "sphère d''influence".
on run {titre, parameters}
set url_noosfere_titre to "https://www.noosfere.org/livres/noosearch.asp?Mots=" & titre & "&Envoyer=Envoyer&livres=livres&ModeRecherche=AND&ModeMoteur=MOTSCLEFS&recherche=1"
display dialog (url_noosfere_titre as text) buttons {"OK", "annulé"}
set retour to button returned of result
if retour is equal to "OK" then
open location url_noosfere_titre
end if
end run
URL with accents is very messy.
Basically URL's should be converted using 2 hexadecimal values with escape character '%'.For instance, "é", should be converted in %C3%A8.
However, result depends of web browser (IE, Safari, Chrome, Firefox) and versions. Sometime the browser is doing its own conversion which you can't avoid.
In your case, it is probably more efficient to change your mind and don't try to fill URL with the word you are searching for, but instead, just display the web page and set your word directly into the search area of the page, then click on the submit button ("Envoyer" in French).
In Applescript, you can manipulate a web page by using Javascript commands.
The script bellow displays your web page, add your word to search in the correct field, select the search area and submit the request by clicking on the submit button.
Doing that, no accent issue at all !
set BaseURL to "https://www.noosfere.org/livres/noosearch.asp?Mots"
set MyWord to "sphère"
tell application "Safari"
open location BaseURL
activate
delay 1 -- time to open the new window. Could be replaced by checking javascript load = complete
tell document 1
-- fill the search field of the page with expression to search
do JavaScript "document.getElementsByClassName('liste')[0].firstElementChild.children[1].value = '" & MyWord & "'"
-- check boxes for search area are 1, 3, 5,...17, 19 in "littérature" block
-- in this example, select the 2nd check box, so index is 3 (="Livres")
do JavaScript "document.getElementById('litt').children[3].click()"
-- click on the search button of the page (="Envoyer")
do JavaScript "document.getElementsByClassName('liste')[0].firstElementChild.children[2].click()"
end tell
end tell
fyi, I have been forced to add the selection of a search area (here I click on check box for all books ='Livres') because at least 1 selection in that area is mandatory.

Tosca: How to scan Dropdown textbox which disapper upon opening xScan

I have a problem in scanning a drop-down menu which disappears upon opening the xScan. I need to get the module id of the dropdown menu to verify some test steps.
Do you have any solution with this if it is not really possible to get the module id of the dropdown menu?
Open developer tools in your browser of choice (F12), navigate to the console and input the following code:
var fulldoc='';
var scrollX=0;
var scrollY=0;
document.addEventListener("keydown",function(event){
if(event.key=='q' && event.altKey){
fulldoc=document.body.outerHTML;
scrollY=window.pageYOffset;
scrollX=window.pageXOffset;
}
if(event.key=='w' && event.altKey){
document.body.outerHTML=fulldoc;
document.body.scrollTo(scrollX,scrollY);
}
});
When the window looks the way you would want to scan, press 'Alt + Q', then press 'Alt + W'.
Now your window will freeze and then you can scan your page.
To steer the objects you need to refresh your browser.
You can resolve the issue with below 2 steps
1 - Add some text in textbox which will populate the dropdown below it .
2 - Use Send Keys Module to scroll down and select the value.
I had a similar issue where we had a popup that only appeared when clicking on a text box. The solution we received from the Tricentis trainer was as follows:
Part One
1. Open your application in Chrome
2. Right click the inspect
3. In the inspector window, on the Elements tab, navigate to your html element where it should be (you can do that by clicking on the element and check that you can see the html in the element)
4. Use the debugger to add a break point there, this should pause it and you should be able to see the elements you need to steer it.
5. Once you found the element, you will need the type of element (e.g. div, span, etc), and the class name
Part two
1. Rescan your module and select any element that matches the criteria of your element selected in Part One #5
2. Identify it by only it's class name property and tag
3. Save and close
4. Edit the element in the module view by changing the class name. This should help you steer it
Note: if the element class name is not unique, you might need to use Explicit name.
Good luck

selectDialog with address bar instead of dropdown with Photoshop script

I'm writing a custom script for Photoshop to handle batch processing of images. I have two input folders and an output folder that I need to specify. Right now I'm using something like this to select my folders:
var inputFolder = Folder.selectDialog("Select a folder of images to process");
Because I'm working on a server with a pretty deep folder hierarchy, it can be a real pain to select through the drop-down menu that Photoshop presents to me in this dialog.
It would be so much easier to have a folder selection dialog with an address bar and quick access panel like this:
All other PS scripts that I've been digging around in use the Folder.selectDialog method to set file paths to a variable. Is there a reason for this? If not, then how can I instruct Photoshop the second style of folder navigation dialog?
It doesn't appear that Adobe supports this dialog as a folder selecting option.
There was a similar thread to this posted on the Adobe forums where a workaround was suggested:
https://forums.adobe.com/thread/1094128
The solution that was suggested is to use a saveDialog function instead of selectFolder. This gives you the folder dialog that we want, but comes with the downside of having to type a dummy name into the filename path. It also says "Save As" on the top of the dialog box, which is confusing.
Here's what was offered:
by lilsmokie on Nov 8, 2012 2:19 PM
var dskTop = Folder.desktop;
var dskPth = String(dskTop);
var newSpot = new File(dskPth+"/poop");
var selectedFolder = newSpot.saveDlg('Select Destination Folder');
var illFilePath = selectedFolder.path;
alert(illFilePath);
This opens the dialog at the desktop. Then put "poop" or whatever you
like in the text field. There the user can navigate to where ever.
When they it save illFilePath will have the folder path. Not perfect
but its close enough for me right now.
I've also discovered that I can set the starting location of the selectDialog by using selectDlg instead:
var outputFolder = Folder(app.activeDocument.path).selectDlg("Select a folder to output images to:");
This gives some control over the starting location so that the user doesn't have to click through a million dropdowns.
At the bottom of your first screenshot you can see the unput text area Folder: This PC. It works just like an address bar. You can type (or paste) something like \\server\work\folder\subfolder into this area and you get this folder ('subfolder' in this case) immediately.
On MacOS this dialog doesn't show the Folder: ... input area. But you can press Cmd-Shift-G and get the native system 'address bar' anytime.

Nintex Mask Context item URL

I have created an email to send a notification when a list item has been modified.
The email should send a link to the item using Context Item URL. So far I have the email ending the URL , but is there anyway I can mask it so it just displays a hyperlink "View Here" rather than the whole url string ?
I have been trying for hours and have no Idea how to do this.
Thank you for your help
As usual as soon as I posted this I found the answer.
This turned out to be a peculiarity with SharePoint where it didn’t give any prompt or indications that you had to double click not just select an item.
1 Insert link
2 Place place you mouse in Address
3 Double Click the Context Item URL
4 Field Populates & enter the display name.