fireEvent/onblur IE11 problem

Class library usage, coding and language questions.
GeorgeK
Posts: 2
Joined: Wed Aug 12, 2015 12:32 pm

fireEvent/onblur IE11 problem

Post by GeorgeK » Wed Aug 12, 2015 1:42 pm

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?

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3930
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: fireEvent/onblur IE11 problem

Post by odklizec » Fri Aug 14, 2015 9:37 am

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
ExecuteScript.png (95.4 KiB) Viewed 3258 times
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()");	
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

GeorgeK
Posts: 2
Joined: Wed Aug 12, 2015 12:32 pm

Re: fireEvent/onblur IE11 problem

Post by GeorgeK » Fri Aug 14, 2015 3:36 pm

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;}.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: fireEvent/onblur IE11 problem

Post by Support Team » Thu Aug 20, 2015 4:05 pm

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)
.
Image