Selenium webdriver | driver().switchTo().defaultContent()
method is not switching the control back to parent window from multiple child windows.
I am facing problem with respect to no of windows and not frames. When I click a button on parent window say wp, a new web window say w1 is getting generated and eventually one more window gets generated say w2 , I want to switch to control to wp so I am using
driver.switchTo.defaultContent()
but its not switching control to parent window.
i have this problem to. and i find answer try this, and give me feedback - maybe i can help you
const number1 = await driver.wait(until.elementLocated(By.xpath('your xpath')))
await driver.executeScript("arguments[0].click()", number1).then(() =>{
console.log(driver.executeScript, 'Click done');
})