I have made a simple program that opens a new tab in my default browser when clicked the Open OpenSea Tab
button, here:
import tkinter as tk
import webbrowser
root = tk.Tk() #create a GUI element
root.geometry('500x400') #resolution
root.title("Bulkdozer") #Name of this program
root.attributes('-topmost', True) #keep the program's window top-most
def open_chrome_profile():
webbrowser.open_new_tab('https://opensea.io/asset/create') #open a new tab using user's default browser
#####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) #give some specifications
#####BUTTON ZONE END#######
root.mainloop()
GUI preview:
Result after clicking the "Open OpenSea Tab" button:
So far so good, now, it happens that I need to make the program above interact with the OpenSea Tab, specifically to evaluate if the OpenSea page is asking the user for connecting a wallet or not, so I know I can use Selenium
package for that, and I tried first to make this program open a window in my default browser using the following code:
import tkinter as tk
#from tkinter import filedialog
#import webbrowser
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument("--user-data-dir="+r"C:\Users\ResetStoreX\AppData\Local\BraveSoftware\Brave-Browser\User Data\Default") # change to profile path
chrome_options.add_argument('--profile-directory='+'Default')
driver = webdriver.Chrome(executable_path="C:\Program Files (x86)\BraveSoftware\Brave-Browser\Application\brave.exe", chrome_options=chrome_options) # change the executable_path too
root = tk.Tk() #create a GUI element
root.geometry('500x400') #resolution
root.title("Bulkdozer") #Name of this program
root.attributes('-topmost', True) #keep the program's window top-most
def open_chrome_profile():
driver.ExecuteScript("window.open('your URL', '_blank');") #open a new tab using user's default browser
#####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) #give some visual specifications for the button
#####BUTTON ZONE END#######
root.mainloop()
But it threw the following errors:
C:\Users\ResetStoreX\Pictures\Cryptobote\Cryptobote NFTs\Crypto Cangrejos\bulk masive\bulk-dozer.py:19: DeprecationWarning: executable_path has been deprecated, please pass in a Service object
driver = webdriver.Chrome(executable_path="C:\Program Files (x86)\BraveSoftware\Brave-Browser\Application\brave.exe", chrome_options=chrome_options) # change the executable_path too C:\Users\ResetStoreX\Pictures\Cryptobote\Cryptobote NFTs\Crypto Cangrejos\bulk masive\bulk-dozer.py:19: DeprecationWarning: use options instead of chrome_options driver = webdriver.Chrome(executable_path="C:\Program Files (x86)\BraveSoftware\Brave-Browser\Application\brave.exe", chrome_options=chrome_options) # change the executable_path too Traceback (most recent call last):File "C:\Users\ResetStoreX\miniconda3\envs\spyder-env\lib\site-packages\selenium\webdriver\common\service.py", line 71, in start self.process = subprocess.Popen(cmd, env=self.env,
File "C:\Users\ResetStoreX\miniconda3\envs\spyder-env\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 108, in init super(SubprocessPopen, self).init(*args, **kwargs)
File "C:\Users\ResetStoreX\miniconda3\envs\spyder-env\lib\subprocess.py", line 951, in init self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\ResetStoreX\miniconda3\envs\spyder-env\lib\subprocess.py", line 1420, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] El sistema no puede encontrar el archivo especificado
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\ResetStoreX\Pictures\Cryptobote\Cryptobote NFTs\Crypto Cangrejos\bulk masive\bulk-dozer.py", line 19, in driver = webdriver.Chrome(executable_path="C:\Program Files (x86)\BraveSoftware\Brave-Browser\Application\brave.exe", chrome_options=chrome_options) # change the executable_path too
File "C:\Users\ResetStoreX\miniconda3\envs\spyder-env\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 70, in init super(WebDriver, self).init(DesiredCapabilities.CHROME['browserName'], "goog",
File "C:\Users\ResetStoreX\miniconda3\envs\spyder-env\lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 90, in init self.service.start()
File "C:\Users\ResetStoreX\miniconda3\envs\spyder-env\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start raise WebDriverException(
WebDriverException: 'Applicatiorave.exe' executable needs to be in PATH. Please see https://chromedriver.chromium.org/home
I know I ended up breaking my program very badly, so I would like to know what did go wrong?
Or if there's a more simple way to interact with the OpenSea tab using the initial code, I'm all ears...