Quantcast
Channel: New board topics in SmartBear Community
Viewing all articles
Browse latest Browse all 20755

Focus Issues clicking JButton in Java Application

$
0
0

Below is my code to click a given button:

 

function ClickButton(TheButton){
  //Works Intermittantly
  TheButton.grabFocus();
  aqUtils.Delay(1000);
  TheButton.Click();
}

 

 

If i click the parent window with my mouse before starting the test, the code works.

 

However, if I do not, it seems like the button is clicked, but nothing happens.

My assumption is this has to do with focus.

 

Is there a way I can ensure the button has focus before clicking it?

 

Programatically clicking the button twice seems to work, but that approach seems less than Ideal and I think it could cause other problems.

 

Thanks,

- James


Viewing all articles
Browse latest Browse all 20755

Trending Articles