How do I link to specific search result? - hyperlink

I have a license number and I want to link to the specific results I get when that number is entered into the following form:
http://www.idfpr.com/LicenseLookUp/LicenseLookup.asp
However, the URL for the search results is always the same and not specific to the results (the URL is: http://www.idfpr.com/LicenseLookUp/results.asp).
Any ideas?

Use a debugger like firebug in firefox or the Google Chrome debugger. Inspect the form and set the method to 'get' instead of 'post' and click the button.
Now you can get something like this:
http://www.idfpr.com/LicenseLookUp/results.asp?TYPE=NAME&pro_cde=0219&lnme=wew&checkbox=on&finit=A&rowcount=1&submit1.x=42&submit1.y=8

Related

AppiumLibrary for Robot Framework - Getting A Button's Text

I am experimenting with AppiumLibrary in RobotFramework and have a simple test for a requirement that states: "the Set button should exist on this page.". I am testing this by retrieving the button that has a specified ID and then checking if that button has the right text.
I am able to retrieve the button I want via ID however am having trouble getting the actual text on the button.
Here is how the button is defined on the web page:
<button id="button-set" class="button ng-binding" style="width: 20%">Set</button>
Very simple! Using Appium Desktop in web/hybrid app mode and clicking on the Set button it says the "text" attribute shows "Set". However I've learned that using the attributes in Appium Desktop arent valid when searching for elements on a webpage, for example searching by the Class attribute in Appium Desktop (android.widget.Button) is not correct because on the web page the class for the button is instead: "button ng-binding".
I have tried the following:
# this retrieves the button fine, by ID
PAGE SHOULD CONTAIN ELEMENT xpath=//button[#id="button-set"]
# these all return 'None'
${name}= GET ELEMENT ATTRIBUTE xpath=//button[#id="button-set"] name
${text}= GET ELEMENT ATTRIBUTE xpath=//button[#id="button-Set"] text
So, I am unsure which Attribute to use to retrieve the text when retrieving element by ID. Instead, I have tried to retrieve the element this way:
# this also passes fine - I feel like I should also make sure this button has the correct ID, to make the mapping
# between test procedures and cases easier, but if this is as good as it gets then
# this can be argued for
PAGE SHOULD CONTAIN ELEMENT xpath=//button[contains(text(),'set')]
# however, the following does not make sense, this returns "button" instead of "button-set", which makes me think the xpath query is not correct
${id2}= GET ELEMENT ATTRIBUTE xpath=//button[contains(text(),'set')] id
# again, both of these return 'None'
${name2}= GET ELEMENT ATTRIBUTE xpath=//button[contains(text(),'set')] name
${text2}= GET ELEMENT ATTRIBUTE xpath=//button[contains(text(),'set')] text
I have also tried the following:
${element}= GET WEBELEMENT xpath=//button[#id="button-set"]
# this returns "button-set" as you'd expect:
${id3}= GET ELEMENT ATTRIBUTE ${element} id
# these again return 'None'
${name3}= GET ELEMENT ATTRIBUTE ${element} name
${text3}= GET ELEMENT ATTRIBUTE ${element} text
I feel like this should be a very simple thing to do, and can see in other questions that you would use the Name attribute when using pure Appium. However, using the Robot Framework library instead, that these doesn't appear to be the right approach. I must be doing something pretty simple wrong here, can anyone point it out?
Thank you!
Stumbling across the same issue when trying to fetch element's attributes via Get Element Attribute keyword. It seems that when fetching for the element's text, your best bet is to use Get Text keyword. Switching to Get Text keyword solved the problem on my case. Please see the links below for further details. Spoiler: there aren't any real explanations as to why the Get Element Attribute is flaky.
https://serhatbolsu.github.io/robotframework-appiumlibrary/AppiumLibrary.html#Get%20Text
https://github.com/serhatbolsu/robotframework-appiumlibrary/issues/98

Why is my external link rendered as internal link?

I have a form that let people enter various links on my website like: http, https and ftp. When someone enters "http:stackoverflow.com", "https:stackoverflow.com" and "ftp:stackoverflow.com" and renders these in a view like this:
<ul>
#foreach (var link in Model.Keyword.References)
{
<li>
#link.Link
</li>
}
</ul>
I get the following output:
http:stackoverflow.com
https:stackoverflow.com
ftp:stackoverflow.com
This looks fine but when I hover "http:stackoverflow.com" the real link is: "localhost:1973/stackoverflow.com".
When I hover the https and ftp links I get the correct output:
https://stackoverflow.com
ftp://stackoverflow.com
I found out that the http links requires two "forward slashes" when I submit them via a form. So instead of "http:" you get "http://". I would like to know why https and ftp links do not need these extra slashes. I would also like to know a good solution for this because I don't think I should force an user to use these extra slashes.
The slashes in the URL are always required. It could be that your browser does some correction to the invalid url. Try to put https:stackoverflow.com in the addressbar of your browser and it will try to correct it in most browsers.
As for a good solution, I think you should only accept the domain without http://. You can put some small text underneath the input that shows "Example: 'www.somedomain.com'", so that the user knows the protocol in the front is not needed.
You can then use JQUERY/REGEX to validate and trim off any protocol stuff someone might add mistakingly.

SSRS create hyperlink on report to aspx page of my application with some value as querystring.

I want to send SSRS report field as querystring paramater to my application page. for this I have done following steps:
To add a hyperlink in report:
In report design view, right-click the text box I want to add a link and then click Properties.
1.In the Properties dialog box, click Action.
2.Select Go to URL. An additional section appears in the dialog box for this option.
3.In Select URL, in expression that evaluates to a URL, in pasted my pages url and concatenated it with field value in the below manner.
http://localhost:64970/InvoiceManagement.aspx?a=Fields!INVOICE_NUMBER.Value
Click OK.
but on running report and clicking on the hyperlink, it redirects me well but in querystring i got Fields!INVOICE_NUMBER.Value, it doesnt get replaced by its value(database value which is int), which should be the Invoice number.
where I am going wrong..
Your field is being evaluated as a literal string. You need to write a function to generate the URL:
="http://localhost:64970/InvoiceManagement.aspx?a=" & Fields!INVOICE_NUMBER.Value
There should be a function box for URL target you can click in the properties dialog, or you could paste the function code in over your URL's text. Note: I'm using VS to manage my SSRS reports, and I'm unsure if these methods are the same for BIDS, if that's what you're using. The problem is the same either way, though.

parsing some code for url

I have to extract some code of the web page: *http://www.bebesymas.com/edades/bebes-de-menos-de-6-meses/bebe-de-4-meses The problem that I have is what I would like to extract is when I click on the icon "Leer Mas". With Firebug I see that it seems that it executes some Ajax code. How could I extract the correct URL to can extract what I want. Many thanks and sorry for my English
If you look at the NET tab in Firebug, you will see that when clicking the link it fetches this URL:
http://www.bebesymas.com/json/productdesc/20351/27211
Now if you search the HTML for 27211 you will find this:
So you just need to grab the productid and the postid from those two elements and then construct the URL like so:
http://www.bebesymas.com/json/productdesc/productid/postid

Get the text value of a link via firefox context menu

How do I get the title of a link element when right clicking in firefox?
I can get the url using:
gContextMenu.linkURL
I have tried the following to get the value but it returns nothing.
gContextMenu.target.value
I can't see any other property that would help in the docs: http://developer.mozilla.org/en/XUL/PopupGuide/ContextMenus#Determining_what_was_Context_Clicked
of course it should be: gContextMenu.target.innerHTML as the a element has no value attribute.
"Bookmark This Link" uses gContextMenu.linkText()

Resources