English > PVD Python Scripts
Firefox Selenium Script Discussion
afrocuban:
--- Quote from: Ivek23 on March 15, 2025, 08:44:54 pm ---Interesting, I also did a test with Chromedriver (without using the Chrome browser), and it works great there.
--- End quote ---
I am so happy to hear it works!
--- Quote from: Ivek23 on March 15, 2025, 08:44:54 pm ---Here are the Scripts adapted for firefox so that you can see my adaptation and maybe errors or I did something wrong or did not change anything.
--- End quote ---
The script looks mostly fine, but there is an issue in the following lines:
--- Quote ---firefox_options_options.add_argument("--headless") # Running Firefox in headless mode
firefox_options_options.add_argument(f"--lang={language_code}")
firefox_options_options.add_argument("--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36")
firefox_options_options.add_argument("--enable-unsafe-swiftshader") # Add this flag to use unsafe SwiftShader
--- End quote ---
Here, firefox_options_options is used, but the variable should be firefox_options. The correct lines should be:
--- Quote ---firefox_options.add_argument("--headless") # Running Firefox in headless mode
firefox_options.add_argument(f"--lang={language_code}")
firefox_options.add_argument("--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36")
firefox_options.add_argument("--enable-unsafe-swiftshader") # Add this flag to use unsafe SwiftShader
--- End quote ---
Once this change is made, the script should work as expected. Other than that, the syntax looks correct! Just make sure you have the necessary dependencies installed and the correct path to geckodriver.
Ivek23:
I must have made a mistake, I just didn't notice it (I still have a lot of things to sort out for my mother's passing, so some details are missing and I don't notice them). I'll fix that and see if it works.
Ivek23:
One more thing I should mention is that my NOD32 antivirus program quarantines SeleniumPVDbScriptsConfig-v4.exe from the _Source_Code folder as well as from the Scripts folder due to Suspicious Object. So I have to bring them back from quarantine and specify that NOD32 skips them when scanning again. Once I do that, then the Suspicious Object cause is gone.
Ivek23:
--- Quote from: Ivek23 on March 16, 2025, 07:47:18 am ---I must have made a mistake, I just didn't notice it (I still have a lot of things to sort out for my mother's passing, so some details are missing and I don't notice them). I'll fix that and see if it works.
--- End quote ---
I fixed it now and it works perfectly.
Navigation
[0] Message Index
[*] Previous page
Go to full version