Python Forum

Full Version: Looking for Selenium setup help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello everyone!

I'm a new member to the forum but an old dog in the botting universe.

Doing some deep diving with Python and I am now playing around with Selenium and I am wanting to get it setup correctly (in terms of the available browsers).

I tried to join the SeleniumHQ Google Group but after two weeks of requesting to join I gave up.

Anyway, I can open a FireFox browser now but I also see that there are other browsers available. I tried Chrome but it is flaky and the other one I tried (which I cannot remember atm) never responded.

I would greatly appreciate it if someone could point me to a site or tutorial for getting the Python 3.7 environment setup so that these kinds of issues can be reduced. I also realize that version 3.7 may not be the best for Selenium so I can gear down to 3.6 or even 3.5.

My over goal with Python, is to do web scraping and web automation but I don't want to limit myself to one browser. I also want to do more integration with my development platform.

Thanks in advance.

Buddy
There is setup in Web-scraping part-2.
A tips is use headless setup also when loading browser,just turn of headless.
For FireFox set headless=False.
Eg just comment out line in Chrome,these setup is testet and work Python 3.7.
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import time

#--| Setup
chrome_options = Options()
#chrome_options.add_argument("--headless") #Now load browser
chrome_options.add_argument('--disable-gpu')
chrome_options.add_argument('--log-level=3')
browser = webdriver.Chrome(chrome_options=chrome_options, executable_path=r'C:\cmder\bin\chromedriver.exe')
#--| Parse
browser.get('https://www.python.org/')
time.sleep(2)
comment = browser.find_element_by_xpath('//*[@id="dive-into-python"]/ul[2]/li[1]/div[1]/pre/code/span[1]')
print(comment.text)
time.sleep(5)
browser.quit()
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
import time

#--| Setup
options = Options()
options.set_headless(headless=False) #Now load browser
caps = webdriver.DesiredCapabilities().FIREFOX
caps["marionette"] = True
browser = webdriver.Firefox(firefox_options=options, capabilities=caps, executable_path=r"C:\cmder\bin\geckodriver.exe")
#--| Parse
browser.get('https://www.python.org/')
time.sleep(2)
comment = browser.find_element_by_xpath('//*[@id="dive-into-python"]/ul[2]/li[1]/div[1]/pre/code/span[1]')
print(comment.text)
time.sleep(5)
browser.quit()
Mucho Thanks!

Checking it out now.

Buddy
@snippsat Thanks for the info! I now have FF and Chrome working.

Any idea on how to get Edge working?

I also read that Safari is no longer being updated for the Windows environment. Any truth to that?

Thanks

Buddy