Python Selenium cannot detect button located on current page after new tab is being opened, it still sees old page as like html structure... It doesn't click does not copy or do anything with one opened tab, only the one I first opened when run the program
here is the code:
driver = webdriver.Chrome(path)
driver.get("https://temp-mail.org/en")
time.sleep(10)
button = driver.find_element_by_xpath('//*[@id="tm-body"]/div[1]/div/div/div[2]/div[1]/form/div[2]/button')
button.click()
time.sleep(5)
time.sleep(5)
driver.execute_script("window.open('https://facebook.com','_blank')")
time.sleep(10)
register = driver.find_element_by_id("u_0_2_/t").click()
I have tried on different website but still not working, also tried clicking on the element of previous tab website and it works, that's why I think it's because selenium cannot detect new tab as new html code to get elements from
It throws this error: raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="u_0_2_/t"]"}
(Session info: chrome=91.0.4472.124)
and what i want to do is that, open the website temp-mail.org - copy the email address and then register on fb with that email address - but it simply does not click on page of facebook.com after new tab is released (where fb is)
I would really appreciate any kind of help