Press enter in remote machine

274 views
Skip to first unread message

Ranjit kumar Kundu

unread,
Jun 13, 2017, 8:08:19 AM6/13/17
to Selenium Users
Hi All,

In a automation process i am running  my scripts fro m Jenkins . In one script I am getting a child window in which i have popup to handle.

Steps what i have tried 

1.Action (not worked)
2. Alert (not worked )
3. Robot (worked but only in local machine)
4. Not worked 
public void pressEnter(){
 
Keyboard keyboard=((HasInputDevices) driver).getKeyboard();
     //enter a key
     keyboard.pressKey(Keys.ENTER);
 }

So now I just want to press enter which is handled by robot.pressKey() only in local machine , But it is not working in remote machine.


Any solution ?


David

unread,
Jun 13, 2017, 6:12:25 PM6/13/17
to Selenium Users
Are you only able to solve that using robot keypress? Can't do it by some native Selenium call to dismiss the popup?

Because for the robot method, for it to work remotely means you have to run a remote "server" to accept the keypress command since robot is not Selenium Grid / RemoteWebDriver compatible.

Not sure if there is already some extension for selenium grid that adds robot Java class support for remote execution. Some other options as examples include:


where you use some similar/alternative tool to do the keypress remotely

Ranjit kumar Kundu

unread,
Jun 14, 2017, 9:35:47 AM6/14/17
to seleniu...@googlegroups.com
Yes i can only able to do that using robot only when i am doing rdp to access the remote machine.

But when i am running from Jenkins as the screen is not active robot is not working. i have tried sikuli too , but no success when running from Jenkins. But sikuli is working when i am running that script locally from that remote machine using RDP.

--
You received this message because you are subscribed to a topic in the Google Groups "Selenium Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/selenium-users/EkuQQFuRzCE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/11d981b3-5950-4fe0-9982-bb974ed9ed21%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

With Regard
Ranjit Kumar Kundu

David

unread,
Jun 14, 2017, 3:25:01 PM6/14/17
to Selenium Users
Since you need UI focus and are running from jenkins, you probably need something like this:


also, hopefully you know why you have your particular problem, and if not, then hopefully the above article explains why. And the referenced solutions there should be able to help you out.
To unsubscribe from this group and all its topics, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.

Ranjit kumar Kundu

unread,
Jun 16, 2017, 3:20:38 AM6/16/17
to seleniu...@googlegroups.com
Below is the page source for which i ma getting that popup in the child window. Let me know if we could accept the popup using javascript Executor. 

<script type="text/javascript">
	function selectContinue( ) {
   	var check = true;
   	check = checkBoxEvent(document.reprocessParamForm, document.reprocessParamForm.reprocessParam);
   	
   	if (check) {
      	if (document.reprocessParamForm.reprocessParam[4].checked && document.reprocessParamForm.reprocessParam[5].checked) {
        		alert('Not valid selection  to check  both Fax all children and Fax to receive Code options'); 
        		return;
      	}
      	
      	if (document.reprocessParamForm.reprocessParam[5].checked && document.reprocessParamForm.reprocessfaxCode.value.length == 0) {
        		alert('Please enter receiver code if Fax to receive Code option is checked');
        		return;
      	}
   	}
   	
   	if (check) {
   		var paramIds = checkBoxIds( document.reprocessParamForm,document.reprocessParamForm.reprocessParam);
   		window.opener.fromPopup( paramIds , document.reprocessParamForm.reprocessfaxCode.value );
   	} else {
      	window.opener.fromPopup( null , document.reprocessParamForm.reprocessfaxCode.value );
   	}
   	
   	window.close();
	}
	
	function checkBoxIds(form, obj) {
		var total = 0;
		var Ids = new Array();
		
		if (obj == null) {
			return null;
		}
	       	
		var max = obj.length;
		
		if (""+max =='undefined') {
			if (obj.checked) {
         	return obj.value;
			} else {
				return null;
			}
		} else {          
			for (var idx = 0; idx < max; idx++) {
				if (eval("obj[" + idx + "].checked") == true) {
    				Ids[total] = obj[idx].value;
					total += 1;
   			}
			}
				
     		if (total < 1) {
     			return null;
     		} else {
       		return Ids;
     		}
		}
	}
	
	function checkBoxEvent(form, obj) {
		var total = 0;
		
		if (obj == null){
			return false;
		}
				
		var max = obj.length;
		
		if (""+max =='undefined') {
			if (obj.checked) {
	   		return true;
			} else {
				return false;
			}
		} else {
			for (var idx = 0; idx < max; idx++) {
				if (eval("obj[" + idx + "].checked") == true) {
    				total += 1;
   			}
			}
				
     		if (total < 1) {
     			return false;
     		} else {
       		return true;
     		}
		}
	}
</script>

To unsubscribe from this group and all its topics, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/e6b76bd2-7936-440f-b722-b205ea45ee62%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

vi.s...@gmail.com

unread,
Dec 7, 2017, 11:01:54 PM12/7/17
to Selenium Users
Reply all
Reply to author
Forward
0 new messages