0

I am trying to run my script(Protractor) in Firefox.

There is as iframe on page and I need to click on a link in that iframe. That click redirects to new tab and I need to switch in that tab too.

But by code that click is not working:

var announcementsGadget = gadget.getAnnouncementGadget();
expect(announcementsGadget.isDisplayed()).toBe(true);

var iframe = gadget.getGadgetbyiFrame(announcementsGadget);
browser.switchTo().frame(iframe.getWebElement());

var allAnnouncements = gadget.getAllAnnouncementGadget();
allAnnouncements.click().then(function() {

    browser.getAllWindowHandles().then(function(handles) {
        browser.sleep(4000)
        browser.switchTo().window(handles[1]).then(function() {
            expect(browser.getCurrentUrl()).toEqual();
            browser.sleep(sleep_interval);
            browser.close();
        });

        browser.switchTo().window(handles[0]);
        browser.sleep(5000);
    });
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.