Frage

Image attached is scrrenshoot of window opened in phantomJs driver

How can I maximize Iframe pop-up window in Webdriver ? As shown in the scrrenshot, there are many questions in "Add Work Experience", section which is opened in an iframe. Now when I am trying to answer those questions, I am getting, following exception:- "Exception in thread "main" org.openqa.selenium.ElementNotVisibleException: Error Message => 'Element is not currently visible and may not be manipulated'"

I believe this must be because the popup window opened in iFrame is not in maxmized state, and many questions are not visble, because same code works in ChromeDriver, and by default "Add Work Section" gets opened in maximized state in Chrome.

I have tried.

driver.switchTo().frame(iframes.get(0));

driver.manage().window().maximize();

But this is not working.

Following are detail repro steps :-
1) Go to talentconnect.pge.com/sap/bc/webdynpro/sap/hrrcf_a_unreg_job_search?sap-client=810&sap-wd-configId=ZPERJ_A_UNREG_JOB_SEARCH#

Username:- softwaretesting805@gmail.com Password:- 1Selenium@

2) Search and Apply for any Job and go upto Work Info Page, when you click on Add Work tab, this popup come up, I am trying to Answer State question, which is currentl hidden in Scrrenshot, as All ids in these sites are dynamic, I am answering them using dom structure.

            textElements = driver.getDriver().findElements(
                    By.xpath("//input[@type=\"text\"]"));

I got "question", and "Answer" in my input dto and I answer them in this way

            if (question.contains("Employer")) {
                textElements.get(0).sendKeys(answer);
                continue;
            } else if (question.contains("Start Date")) {
                textElements.get(1).sendKeys(answer);
                continue;
            }                        
War es hilfreich?

Lösung

Run javascript that increase your iframe height and width, i have my own example:

((JavascriptExecutor) driver).executeScript("document.getElementById('containerId').style.height = '200px';");

or

((JavascriptExecutor) driver).executeScript("arguments[0].style.height = '200px';", element);

Andere Tipps

At times Maximize() fails to maximize the window, users can still maximize the window using a workaround mentioning the dimensions.

This code snippet is in Java...

Toolkit tool_kit = Toolkit.getDefaultToolkit (); 
int width=(int) tool_kit.getScreenSize().getWidth();
int height=(int) tool_kit.getScreenSize().getHeight();
Dimension screen_Dimension = new Dimension(width, height);
web_Driver.manage().window().setSize(screen_Dimension);

Hope this helps

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top