from msedge.selenium_tools import Edge, EdgeOptions
edge_options = EdgeOptions()
edge_options.use_chromium = True
# Here you set the path of the profile ending with User Data not the profile folder
edge_options.add_argument(
"user-data-dir=C:\Users\Y\Desktop\edgedriver_win64\Profile")
# Here you specify the actual profile folder
edge_options.add_argument("profile-directory=Profile 1")
edge_options.binary_location = r"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"
driver = Edge(options=edge_options,
executable_path="MicrosoftWebDriver.exe")
def mainloop():
driver.get('https://groupdao.io/%27)
try:
driver.find_element_by_id('tab2').click()
driver.find_element_by_id('allow').click()
except:
return mainloop()
driver.find_element_by_class_name('error')
return mainloop()
mainloop()