I'm attempting to use a Selenium-based framework to test a company web page, but I'm encountering some errors wherein after I generate a report inside of a popup, and then close that popup and attempt to do more testing in my original window, I can no longer send keys to test fields in that window. I can click on html elements and navigate to new pages, and the sendKeys function is NOT throwing any errors, but no text is being entered into the targeted web element when it's called. There doesn't appear to be anything wrong with the web elements themselves - I can still enter text manually, and my scripts can use those same specific elements just fine as long as they haven't closed any popups beforehand, but once I close the popup involved in my test, Selenium stops sending text properly. Any input would be greatly appreciated.
closed as unclear what you're asking by NarendraC, Bharat Mane, kirbycope, FDM, Alexey R. Apr 23 '18 at 14:20
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
Your WebDriver likely needs to switch back to original window after closing the pop-up. Here is a link to the documentation from SeleniumHQ. You can switch by index or window name. You can also hop between iFrames this way.
How are you identifying the element? ID? Css? XPath?
I ask because the popup may have changed the path from before it was created to after it was closed.
Picture this, the page originally has this path to the input field:
You close the popup, but the div remains causing your path to be altered. sendKeys() works, but it's now pointing to some other field you cannot see, thus no error. The opposite could be true, in that the div is originally there but removed when the popup is closed.
It's a long shot, but based on
"...my scripts can use those same specific elements just fine as long as they haven't closed any popups beforehand..."
leads me to believe that the creation and/or closing of the popup is changing the DOM so you are no longer targeting the input field you are trying to fill.
I would think Selenium would throw an error in such cases, usually either
Invalid Element State, or
Stale Reference, but it's worth a shot. Examine the path before, during, and after the popup.