Setting up Selenium over python 2.7 virtualenv


Let's search for PIP installation command



  1. pip install selenium
After install via PIP our selenium module, search for the webDriver, in this case I prefered implement Chrome webDriver, so next step to iwebDriver installation

  1. sudo apt-get install chromium-chromedriver (for apt repositories)
  2. The let's start to code...
    • Open our editor end call to selenium module
    • Declare variable with webDriver module and run
    #!/usr/bin/python3
    from selenium import webdriver
    from selenium.common.exceptions import TimeoutException
    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.support import expected_conditions as EC
    from selenium.webdriver.common.by import By
    url = 'http://www.yoururl.com'
    driver = webdriver.Chrome('/usr/bin/chromedriver')
    <---- Call to webDriver installation router on the SO
    driver.get(url)
    print(driver.title)
    •  Then run and I fount some issues like:

    Traceback (most recent call last):
      File "bikes/main.py", line 12, in <module>
        user = webdriver.Chrome('/usr/bin/chromedriver')
      File "/home/system/craweler/local/lib/python2.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
        desired_capabilities=desired_capabilities)
      File "/home/system/craweler/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
        self.start_session(capabilities, browser_profile)
      File "/home/system/craweler/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
        response = self.execute(Command.NEW_SESSION, parameters)
      File "/home/system/craweler/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
        self.error_handler.check_response(response)
      File "/home/system/craweler/local/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
        raise exception_class(message, screen, stacktrace)
    selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally
      (unknown error: DevToolsActivePort file doesn't exist)
      (The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
    • Solved addind additional parameters to webDriver declaration:
    chrome_options = webdriver.ChromeOptions()chrome_options.add_argument('--headless')chrome_options.add_argument('--no-sandbox')chrome_options.add_argument('--disable-dev-shm-usage')

    • Then now our webDriver declaration looks 
    driver = webdriver.Chrome('/usr/bin/chromedriver',chrome_options=chrome_options) 

    And we've ready our selenium installation to start to be use 




                                          GIT

                                          Today I am configuring the remote GIT repository over the shared LAN then some issues I found solving those for this way. remote: erro...