Unable to access modal window , actions not working [duplicate] - java

This question already has answers here:
Unable to Move Out of ViewPort Pane - Selenium
(3 answers)
Closed 4 years ago.
I am trying to automate this website http://the-internet.herokuapp.com where i have to go to http://the-internet.herokuapp.com/exit_intent and hover out of viewport pane so that a modal window appears.
I am not sure how to do this , i tried actions assuming when i go to top right the modal window appears and hence trying to hover around that image but it isnt working.
here is actions code-
driver.get("http://the-internet.herokuapp.com/exit_intent");
Actions ACTION = new Actions(driver);
ACTION.moveToElement(driver.findElement(By.xpath("//a[#href='https://github.com/tourdedave/the-internet']/img"))).build().perform();
I am not sure how to do this , any help is higly appreciated.
This is the URL -http://the-internet.herokuapp.com/exit_intent.
I tried searching SO but unable to find appropriate solution.

You can use driver.switchTo().frame("modalframname");
Then your code .frame will switch u to that frame and u can perform a test on it.

Related

java swing contentPane.remove remove the panels but graphics stay on screen [duplicate]

This question already has answers here:
Unable to remove JLabel from JPanel after adding programmatically
(2 answers)
Closed 3 years ago.
so I have this perfectly normal code
the thing is that these elemnts get removed from the panel (logically) but the graphics stay for example the button stop interacting it just freez there .
and when I pass a jlabel above (I have drag and drop jlabel) these elements they get wiped.
contentPane.remove(Quitter);
contentPane.remove( PanelInit);
Anyone here have an idea how to fix it ? Thanks in advance .
using the repaint function fixed the whole thing .
hope this help anyone in the future.
contentPane.repaint();

How to add close button to all tabs but one in JavaFX?

I am trying to create a tab system, with similar function to tabs in Chrome, where there is a cross on each tab to close it, like this:
With JavaFX, I can get close, by setting the tabpane closing policy to ALL_TABS. Unfortunately this means my new tab button (also a tab iself) can be closed:
I am aware of the SELECTED_TAB rule, which would fix this problem, but this would defeat the purpose. I am not aware of any other closing policy that would allow exceptions to the ALL_TABS rule.
I tried adding my own cross to each tab individually using the setGraphic method for the Tab class, however I couldn't figure out how to handle that mouse click event such that it closed the correct tab.
I realise I could also make the new tab button something other than a tab, but I wouldn't really know how to integrate that with the tab pane.
So, is there a simpler method that I'm not seeing? If not, then how can I achieve this kind of tabbing system in JavaFX?
plusTab.setClosable(false);
I did a simple skim of the documentation. Will this work?

Display of Java Component is delayed [duplicate]

This question already has answers here:
Will Runnables block the UI thread?
(4 answers)
How to update swing GUI from inside a long method?
(3 answers)
Closed 3 years ago.
I'm facing a strange behavior from the Java Runtime(VM) when I'm trying to display a label or progress bar on the screen when something happens.
The scenario is like this:
the user will press a button to do a certain action
this action is a kind of process on the DB which could take some seconds
I'm displaying a message in a Jlabel field which is already in the form but set to be invisible when the form opens.
Then when the user presses a button I'm setting this label to be visible and do some processing and then set it back again invisible as it was, which is very simple logic.
problem is the Jlable is displayed after the processing is done and not before.
The same problem with happens also a progress bar.
Any explanation why is this happening?
here a sample of the code
Mylable.setVisible(false); defaullt status when the form opens
Event Occurend (user clicked a button)
Mylable.setVisible(true);
....... do some process here
Mylable.setVisible(false);

How to Attach Modal Dialogue to Main Window in JavaFX?

Examples of Attached Modal Dialogues:
Is there any way to bring this to JavaFX?
Couldn't find support for attached dialogs out of the JavaFX box... So, how I would do it...
The dialog part: there's this, no way I'm beating it example gist
And a tweak to the CSS file - the .modal-dialog styleClass:
-fx-position: fixed
-fx-top: 0

How to write a code for default close button in JFrame? [duplicate]

This question already has answers here:
setDefaultCloseOperation to show a JFrame instead
(3 answers)
Closed 8 years ago.
I want to write a code to default close button in JFrame. I just want to ask whether "to save the content or not?" using another JDialog or JOptionPane when click on close button.
Where do I have to write the code? As default close button is not in design of JFrame, and no such event found for JFrame window too, how can I add event listener to that button?
Check out Closing an Application for a couple of solutions:
using a WindowListener and overriding the windowClosing(...) event to display your option pane.
using a simple API so you only need to provide a message or write an ActionListener for more complicated processing.

Categories

Resources