AKarandjeff
13 years agoContributor
Java Dialog Box Identification Issues
I have a situation where a Java Swing JDialog box has a variable caption that will change from run to run. Using the traditional name mapping based on child objects has not worked as TC starts looking for other dialog boxes if the caption is not specified. I have gotten around this by using the full object mapping and specifying the variable part of the dialog by passing the name into the dialog caption.
It looks like this:
TestComplete also seems to think the dialog box is invisible and I got around that by setting the dialog box to visible and then I click on it, just to be sure.
What I am now hung up on is the fact that it seems like the Yes and No buttons in the dialog box are mapped to the same object, as far as Test Complete is concerned.
Both full names map to this:
I want to select the No button, but when I use the above string in my code, the Yes button gets selected. I've tried adding combinations of caption and index to SwingObject("OptionPane.button") (e.g. SwingObject("OptionPane.button","",1) or SwingObject("OptionPane.button", "No",1), etc) but when I do, Test Complete cannot find the object.
I am attaching a word doc which contains a screenshot of the dialog box itself, and object mappings of the Yes and No buttons. Any assistance would be greatly appreciated as this has me dead in the water right now. Thanks.
It looks like this:
dialog = javaw.SwingObject("JDialog", "Update BNMCUST table on Switch: "+ custSwitch +" ?", -1, 1);
TestComplete also seems to think the dialog box is invisible and I got around that by setting the dialog box to visible and then I click on it, just to be sure.
dialog.setVisible(true);
dialog.Click(178, 3);
What I am now hung up on is the fact that it seems like the Yes and No buttons in the dialog box are mapped to the same object, as far as Test Complete is concerned.
Both full names map to this:
Sys.Process("javaw", 2).SwingObject("JDialog", "Update BNMCUST table on Switch: CABLAB ?", -1, 1).SwingObject("JRootPane", "", 0).SwingObject("null.layeredPane").SwingObject("null.contentPane").SwingObject("JOptionPane", "", 0).SwingObject("OptionPane.buttonArea").SwingObject("OptionPane.button")
I want to select the No button, but when I use the above string in my code, the Yes button gets selected. I've tried adding combinations of caption and index to SwingObject("OptionPane.button") (e.g. SwingObject("OptionPane.button","",1) or SwingObject("OptionPane.button", "No",1), etc) but when I do, Test Complete cannot find the object.
I am attaching a word doc which contains a screenshot of the dialog box itself, and object mappings of the Yes and No buttons. Any assistance would be greatly appreciated as this has me dead in the water right now. Thanks.