167
rated 0 times
[
174]
[
7]
/ answers: 1 / hits: 120991
/ 6 Years ago, fri, january 19, 2018, 12:00:00
I have a test case in which I have a link which opens in a new tab. Since Cypress doesn't support multiple tabs, I want to get the href
attribute of that link and then open it in the same tab. I'm trying to do it this way, but for some reason it doesn't work.
it('Advertise link should refer to Contact page', () => {
var link = document.querySelector("div.footer-nav > ul > li:nth-child(2) > a").href;
cy.visit(link);
cy.title().should('include', 'Text');
});
More From » automated-tests