After the very exhaustive research of today, I managed to understand and make a simple program that will use the selenium
module to open a chrome window with my user data and default profile, here:
import tkinter as tk
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
root = tk.Tk()
root.geometry('500x400') #resolution
root.title("Bulkdozer") #Name of this program
root.attributes('-topmost', True) #keep the program's window top-most
opt = Options() #selenium options
opt.add_argument("--user-data-dir="+r"C:\Users\ResetStoreX\AppData\Local\Google\Chrome\User Data\Default") #PATH profile
opt.add_argument('--profile-directory=Default') #Profile to use
s = Service('C:\Program Files\Google\Chrome\Application\chrome.exe')
def open_chrome_profile():
driver = webdriver.Chrome(service=s, options=opt)
driver.get('https://opensea.io/asset/create')
#####BUTTON ZONE#######
open_browser = tk.Button(root, width=20, text="Open OpenSea Tab", command=open_chrome_profile) #executes the function when clicked
open_browser.grid(row=22, column=1)
#####BUTTON ZONE END#######
root.mainloop()
The problem is that it is not working as expected at all:
First, after clicking the Open OpenSea Tab
button, the program DOES open a chrome window with my user data and default profile, but it doesn't go to the link provided ('https://opensea.io/asset/create'
).
And second, it also crashes the GUI without throwing any errors, and even worse, it crashes the Spyder Kernel too!
I'm very confused, to me it doesn't seem I have done any illegal stuff here, but I would appreciate a lot if someone could explain me how should I patch this issue?
I managed to build the code above following the recommendations from this other question, but I never expected ending up with a weird problem like this one in the end...