Ask a Question

[Device Cloud] - Unable to send 'Keys' to CBT remote browser.

krishnabr
Occasional Contributor

[Device Cloud] - Unable to send 'Keys' to CBT remote browser.

Hello,

i am trying to send 'Keys' to browser, it works perfectly fine in local browser, but when i try execute it in CBT remote browser it fails and following is the error message details found.

 

Unable to evaluate the operation's "Keys" parameter. Error: ReferenceError: Enter is not defined
 
Following is my line of code
Sys.Browser().Page("*").FindElement("#LoginButton").Keys([Enter]);
 
tried with all options like 'Click', ClickButton', ClickR, ClickL etc...
any help is appreciated. 
 
9 REPLIES 9
hkim5
Staff

.Keys("[Enter]")

try it with the quotation marks.

Best,
Justin Kim
krishnabr
Occasional Contributor

Thanks @hkim5 , tried the way you suggested and getting below error

 

The specified operation is not supported by the remote instance.

Possible solutions:

  • Avoid using the operation on such instances.
  • Use an instance with different capabilities that supports the operation.

Learn more about known issues and solutions Sys.Browser().Page("*").FindElement("#LoginButton")

im guessing thats because its a button and it doesnt support the keys method. I think the error message is pretty straight forward there. you can use the object spy to target that login button and take a look at all of the methods that they do support. in which case you can most likely just click the button.

Best,
Justin Kim

Hi,

 

I am with Justin and my current understanding (based on the knowledge got from the documentation only, so I would appreciate your opinion based on the experience) is like this:

-- .FindElement() method call in  cross-platform mode is translated into Selenium call that is executed on the target system;

-- Documentation says nothing about object type returned as a result of successful method's call, but considering that TestComplete has no access to the tested system and thus the tested application is absent in the Object Browser, I think that native DOM object is returned as a result;

-- .Keys() method is provided by TestComplete and is absent for native DOM objects;

-- For Selenium they suggest to use something like this to send key presses:

driver.findElement(By.id("content")).sendKeys(Keys.SPACE);

So check methods supported by the button DOM object and try to use them.

 

Regards,
  /Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================

I think the biggest issue here to begin with is that the login button element that you were trying to interact with doesn't support the Keys method in the first place. Which is why I am somewhat skeptical that it worked within your local browser (seeing as the syntax didn't include the quotation marks, so that should have failed regardless of whether or not the browser was local to your machine). 

In my case, when I used the object spy on a similar button object, i was able to find both of the methods of click and keys, so I could use either one, on both local and remote browsers.image.png

If you are building out your script step by step, this would make it extra clear which methods you can/can't use 🙂

 

Best,
Justin Kim
krishnabr
Occasional Contributor

@hkim5 , @AlexKaras  as I said in my initial post, I tried the options what you suggested. the problem is 'TestComplete' shows that the steps was executed successfully but there is no action on remote browser. even I can see the button highlighted on the screen captured, but action was not performed.  the same script was successfully executed on my local browser.

Sys.Browser().Page("*").FindElement("#loginButton").ClickButton();

 

Also, tried using the object spy and tried all suitable methods like Click, ClickButton, ClickR, ClickM etc...

 for some reason the click event is not converted to action on remote browser.

"the problem is 'TestComplete' shows that the steps was executed successfully but there is no action on remote browser. even I can see the button highlighted on the screen captured, but action was not performed.  the same script was successfully executed on my local browser."

 

this is a new problem that i didn't see you reference within your initial post. Let me check internally to see if there are any other reported issues with similar problems. I can understand how this is problematic/really annoying

Best,
Justin Kim
AlexKaras
Champion Level 3

@krishnabr :

[Device Cloud] - Unable to send 'Keys' to CBT remote browser

Could you also clarify:

-- Do you execute tests using CBT integrated with TestComplete (i.e. via CBT object); or

-- Do you execute tests using new cross-platform mode of TestComplete and consuming CBT as a regular device cloud platform ?

 

I think the above information will be useful for @hkim5 .

 

Regards,
  /Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
krishnabr
Occasional Contributor

second one: 

-- execute tests using new cross-platform mode of TestComplete and consuming CBT as a regular device cloud platform.

cancel
Showing results for 
Search instead for 
Did you mean: