Path of a Nixpacks (google-chrome, chromedriver) [Python]

Hello, with the latest update I could install google-chrome and chromedriver using Nixpacks by adding a railway.json file like this (in case other people are interested):
{
"build": {
"builder": "NIXPACKS",
"nixpacksPlan": {
"providers": ["...", "python"],
"phases": {
"setup": {
"nixPkgs": ["...", "google-chrome", "chromedriver"]
}
}
}
}
}
{
"build": {
"builder": "NIXPACKS",
"nixpacksPlan": {
"providers": ["...", "python"],
"phases": {
"setup": {
"nixPkgs": ["...", "google-chrome", "chromedriver"]
}
}
}
}
}
Now in order to use Selenium to webscrape (with permission), I would need to point it to the google-chrome and chromedriver path, but where is it located? How do I get access to it? (In my directories there's just a .nix file btw) Specifically, what should I write instead of '[full-google-chrome-path]' and '[full-chromedriver-path]' in the following situation:
from selenium import webdriver
GOOGLE_CHROME_PATH = '[full-google-chrome-path]'
CHROMEDRIVER_PATH = '[full-chromedriver-path]'
op = webdriver.ChromeOptions()
op.binary_location = GOOGLE_CHROME_PATH
op.add_argument('--headless')
op.add_argument('--disable-gpu')
op.add_argument('--no-sandbox')
op.add_argument('--disable-dev-shm-usage')
driver = webdriver.Chrome(executable_path=CHROMEDRIVER_PATH, chrome_options=op)
from selenium import webdriver
GOOGLE_CHROME_PATH = '[full-google-chrome-path]'
CHROMEDRIVER_PATH = '[full-chromedriver-path]'
op = webdriver.ChromeOptions()
op.binary_location = GOOGLE_CHROME_PATH
op.add_argument('--headless')
op.add_argument('--disable-gpu')
op.add_argument('--no-sandbox')
op.add_argument('--disable-dev-shm-usage')
driver = webdriver.Chrome(executable_path=CHROMEDRIVER_PATH, chrome_options=op)
Thanks!
5 Replies
Percy
Percy2y ago
Project ID: N/A
Azu𝕏orce@シノン教
N/A This is probably a newbie question, but that's what I am in Nixpacks... maybe someone can give me a clue on this? It's probably just a one-sentence answer. Thanks! Or do I have to install google-chrome after that? How would I do that actually? Help is very appreciated! If this is too trivial that everyone is facepalming me and moving on, please at least react so that I know this is trivial and I'm simply dumb... 😦
jr
jr2y ago
Hi @AzuXorce(at)シノン教, Sorry for such a delayed response on this. I haven't used google-chrome or chromedriver on nix before, but the paths of the binaries can be found in /root/.nix-profile/bin
jr
jr2y ago
jr
jr2y ago
You might also want the dev or beta versions of chrome