How to automate text writing in popup - selenium

I want to automate text writing in popup. Is it possible? if yes, then please guide me. Any help will be well appreciated.

If it's a browser popup, it sounds like you're looking for:
driver.switchTo().alert().sendKeys("some text to enter");

I got the solution:
driver.switchTo().frame(0);
driver.findElement(By.id("id of the view to enter text in the popup")).sendKeys("some text to enter");

Related

How to save a webpage with Selenium IDE using CTRL + S?

I am trying to emulate the ctrl+S to save the webpage as html but I can't make it work with Selenium IDE. I tried to look all over SO but there was nothing in particular about this.
I tried the following:
But when I ran the test, the popup did not show to ask me whether I want to save the page.
Am I missing something ?
Thanks in advance.
Maybe you can use something like Autoit to click in "Save" button that you can't reach with Selenium?

How to verify text using selenium on popup notification before vanishing it

There is a requirement like verifying Text using selenium on Popup notification before vanishing.
Not find any suitable solution for this.Please help me in this use-case
You can use the below code to get text from popup after that you can assert with the expected text
String value =driver.switchTo().alert().getText();
it is really unpredictable to understand your scenario.We must need pop-up HTML and a screenshot, and what problem you are facing.Sometime the pop up might be bootstrap modal or alert, so without knowing the popup, it is not possible to give the solution.Besides you can try simply find the element and use getText() function.If it is simple modal(Bootstrap), it will give you the text.
If you are struggling to find the element you can pause the JavaScript by using F8.

How to get driver when pop up appears - Selenium

I am finding difficulties to get the driver when popup appears. when I click a button, then it will open another browser window. can someone give me the tips how to get the driver on the popup browser? thank you
Please review again, this may be iframe, Please inspect with fire bug properly,and if page have iframe , then code with frame related property. If you feel again problem, please share the more information about code.
You can read more about iFrames and do something like this driver.switchtoiFrame. You will have to read its HTML to find it out if thats an iFrame, else if its a Pop-up then you need to switch to that Popup first

Selenium IDE - Not capturing button link

In Selenium IDE, the application has got image as button. The click event for that is not capturing. Is there any alternative Selenium Commands available for that or otherwise, is there any JavaScript user extensions can be added?
Please help.
Thanks
Yes.. the image will act as a button..
Found a solution for that!!
Simply added a JavaScript code which supports clickAt() commands.
To detect button as image you can use one of the below solution
xpath=//img[#src='/images/logo_home.png']
xpath=//img[#alt='Home']
//img[#src='/images/logo_home.png']

How to handle dialog box through selenium with python?

I am new in Selenium automation. Could you please explain me how to use this (if one exists) tag? It would be really helpful if you can give example.
The scenario where I am facing problem is: there is a save button, if we click on it a dialog box pops up. I need to enter some text in two text boxes and press save/cancel button on the same dialog. I am using Selenium as a tool and Python as a scripting language. Any help on this will be appreciated.
Thanks in advance!
sel.click("idOfSaveButton")
sel.wait_for_pop_up("popupWindowName", "30000")
sel.select_window("name=popupWindowName")
sel.type("idOfTextBox1", "someText")
sel.type("idOfTextBox2", "someText")
sel.click("idOfCloseButton")
sel.select_window("null")
You can also select the popup window using title=.
You can wait for the confirm box, then switch to it and do whatever you want. I asked familiar question before and the answer is here. Hope it helps.