handle chrome alerts through UFT - javascript

I am trying to handle chrome alerts through UFT(Unified Funtional Testing)/QTP(Quick Test Professional). There are only a few options such as Insight objects, sendkeys or by coordinate values. I need more robust way to handle these alerts. Like how the selenium does with help of webdriver.
Is there any other way to handle alerts externally such that those methods can be triggered through a .vbs file?
Please suggest.

UFT has the Browser.HandleDialog functionality which allows clicking OK on alert and confirm dialogs, clicking Cancel on confirm and prompt dialogs and entering values for prompt dialogs.
Usage:
Browser("B").HandleDialog micOK
Browser("B").HandleDialog micCancel
Browser("B").HandleDialog micOK, "value for prompt dialog"

Related

How to storeConfirmation in popup SeleniumIDE

Can u help me about StoreConfirmation for popup SeleniumIde ? + example command.
please answer only selenium IDE.
Thanks
If you are talking about default javascript alert or confirmation there are two commands for it:
storeAlert
Returns:
The message of the most recent JavaScript alert
Retrieves the message of a JavaScript alert generated during the
previous action, or fail if there were no alerts.
Getting an alert has the same effect as manually clicking OK. If an
alert is generated but you do not consume it with getAlert, the next
Selenium action will fail.
Under Selenium, JavaScript alerts will NOT pop up a visible alert
dialog.
Selenium does NOT support JavaScript alerts that are generated in a
page's onload() event handler. In this case a visible dialog WILL be
generated and Selenium will hang until someone manually clicks OK.
storeConfirmation
Returns:
the message of the most recent JavaScript confirmation dialog
Retrieves the message of a JavaScript confirmation dialog generated
during the previous action.
By default, the confirm function will return true, having the same
effect as manually clicking OK. This can be changed by prior execution
of the chooseCancelOnNextConfirmation command.
If an confirmation is generated but you do not consume it with
getConfirmation, the next Selenium action will fail.
NOTE: under Selenium, JavaScript confirmations will NOT pop up a
visible dialog.
NOTE: Selenium does NOT support JavaScript confirmations that are
generated in a page's onload() event handler. In this case a visible
dialog WILL be generated and Selenium will hang until you manually
click OK.
You can see working example here : http://www.software-testing-tutorials-automation.com/2013/10/selenium-ide-what-is-use-of.html
Hope it will help you.

Unable to identify "Authentication Required" Dialog

I'm using QTP 12.02 and chrome v43. How do I make QTP identify the fields inside the dialog box? Object spy only identifies the object behind the dialog box.
As far as I know Chrome's authentication dialog is not supported by UFT/QTP, you can however use Insight (image based testing) in order to pass this dialog.

window.confirm message not working when user disables additional dialogue from the browser

I am new to java script. And now have gone into a really serious problem.
Please help..................! stackoverflow
I have one jsp page for deleting entries. where user can delete data. As soon as he clicks delete button , he gets a confirmation window saying "Are you sure you want to delete..?". Problem is when user deletes 4,5 entries he gets an alert from the browser saying " [*] Prevent this page from creating additional dialogues." when user clicks the checkbox and prevents himself getting additional dialogues. my confirmation message "Are you sure you want to delete?" also gets blocked and user is unable to delete the data and the whole portal becomes useless.
please help me and let me know is there any way to handle that using javascript.
Browser alerts are little irritating. Create your custom popup or use Jquery popup. You cannot control browser alerts behaviour
You can use one of the best plugin for alerts and confirm dialogs
http://nakupanda.github.io/bootstrap3-dialog/

automatically press keyboard keys with jQuery

Here is a button whenever it's clicked. Automatically keybord keys are pressed ctrl+shift+p.
This is actually window print shortcut key.How can I do that. Because when window.print() function is used in google chrome. chrome show chrome print dialog box. but I want window print dialog and this is the shortcut key of window print dialog.
You can disable the default behavior of chrome print box. May be you can refer this link for that
http://ryan.mcgeary.org/2012/09/13/disable-chrome-print-dialog-use-osx-instead/
This will serve well for you but If you are looking something to do it globally for all the users then you may have to go through some other option... Will try to find an alternate for that as well.
Hope this be of some help
Happy Learning

Scripts not running in FF and Chrome

I am using javascript alert message to show validation messages. In Firefox and Chrome first time working fine,second time for same alert same its asking message like "Prevent this page from creating additional dialogs" with check box. After select that check box, Next time button click scripts not executing. How to block that message?
Use a JavaScript Modal popup! eg. JQuery UI Modal Popup
This is a browser matter, so you as a developer cant do anything with that behavior.
Here is a similar question
already answered here
unfortunately you can't be sure that user has his browser settings with javascript alerts popup on ( that called with 'alert('...') function').
You should use javascript dialog plygin instead.
For example:
http://fancybox.net/
its a browser property for the client,if he doesnt want to view these alerts. you cant remove that check box and message.
if this message is shown then what the problem, leave it for the user.
why you want to force him to view these alerts,
it must be user's wish to see or not see these alerts.
for better user experience and for your purpose you can use fancybox or facebox
fancy box fiddler check this http://jsfiddle.net/BJNYr/

Categories