Page 1 of 1

fireEvent/onblur IE11 problem

Posted: Wed Aug 12, 2015 1:42 pm
by GeorgeK
We are using multiple input fields for data on heavily scripted webclient (multiple functions are processing input data).

Internet Explorer 11, Windows 7 64-bit, Ranorex 5.3.2.23378.

Entering input text through:

Code: Select all

inputIDtest.Element.SetAttributeValue("Value", "testvalue")
sets value correctly, but following code

Code: Select all

inputIDtest.RaiseEvent("onblur")
doesn't seem to actually fire onblur event - so the attached functions are not processing the value.

I have tested running simple javascript code (bookmarklet) on the same webpage:

Code: Select all

inputs.namedItem('inputIDtest').value = "testvalue"
inputs.namedItem('inputIDtest').fireEvent('onblur')
onblur is fired correctly and value is processed by functions.


I am not sure if RaiseEvent is actually supposed to do what I am expecting it to do (same thing as fireEvent) - it doesn't actually fire event on simple code like:

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8">
	<title>script</title>
	<script type="text/javascript">
	function MoveOut() {
	document.getElementsByTagName('input').namedItem('inputIDtest').innerText = "ONBLUR FIRED";
	}
	function MoveIn() {
	document.getElementsByTagName('input').namedItem('inputIDtest').innerText = "ONFOCUS FIRED";
	}
	</script>
</head>
<body>
<p>Test input:&nbsp;<input id="inputIDtest" type="text" onblur="MoveOut()" onfocus="MoveIn()"></p>
</body>
</html>
Am I missing something or doing it wrong? Or is there some other way to utilize fireEvent in Ranorex?

Re: fireEvent/onblur IE11 problem

Posted: Fri Aug 14, 2015 9:37 am
by odklizec
Hi,

It seems you have the RaiseEvent right, so I don't know why it does not work? I tried it via spy (right click over Input element >> select RaiseEvent action). However, I was able to fire up the event via ExecuteScript over the parent iFrame...
ExecuteScript.png
So all you need to do is to add iframeResult to the repository and call the ExecuteScript from it using MoveOut() function, like this...

Code: Select all

repo.iFrameResult.ExecuteScript("MoveOut()");	

Re: fireEvent/onblur IE11 problem

Posted: Fri Aug 14, 2015 3:36 pm
by GeorgeK
Thank you, definitely an interesting option, though probably not optimal in our current situation. I'll use Mouse Left Click for now.

I did some tests with ExecuteScript - using modified example code I've posted above (loaded in iframe) - and ExecuteScript seems to always return 'undefined', regardless of actual return value used - for example executing function ReturnNumber() {return 8;}.

Re: fireEvent/onblur IE11 problem

Posted: Thu Aug 20, 2015 4:05 pm
by Support Team
Hi GeorgeK,

Thank you for reporting the issue concerning the return value.
I observed, even if the return value is “undefined” the function will be executed properly. Anyway, I’ve already informed our responsible development department about the problem and one of my colleagues will analyze it in more detail.
Thank you for your patience.

Regards,

Markus (S)