Tutorial: Selenium Automation on Google Colab Notebook

Поделиться
HTML-код
  • Опубликовано: 2 дек 2024

Комментарии • 86

  • @soroush_thr
    @soroush_thr Год назад +32

    Perfectly explained! Just note that if you are receiving errors with Webdriver.Chrome not having an execuatable_path argument, simply omit this argument and run with the options only ( driver = webdriver.Chrome(options=options) ). New versions of selenium do not support this argument and it is not necessary to be included.

    • @ScrapingNinja
      @ScrapingNinja  Год назад +1

      thanks for the input Soroush Taheri, i completely agree with you...

    • @soroush_thr
      @soroush_thr Год назад

      @@ScrapingNinja All thanks to you, sir! 🙌

    • @luizcarlosjunior9384
      @luizcarlosjunior9384 Год назад

      Thank You!

    • @omatematicoinvestidor
      @omatematicoinvestidor Год назад

      Thank you so much, sir. You saved me! :)

    • @soroush_thr
      @soroush_thr Год назад +1

      @@omatematicoinvestidor you're welcome, sir! I'm glad it was helpful

  • @lochanaemandi6405
    @lochanaemandi6405 Год назад +4

    Thank you so very much. After 9 hours of wasting time on google, I found this video. Keep making more videos bro. Great help

    • @ScrapingNinja
      @ScrapingNinja  Год назад

      You are welcome Lochana i am glad you found this video useful, don’t forget to subscribe

  • @chomchomeizy4098
    @chomchomeizy4098 6 месяцев назад

    Thank you so much for this video. I wasted 24 hours in futility trying to find a way to get Selenium to work on Colab; TILL i found your video, and bam! It worked. I had errors with the executable path, so i had to remove it completely and passed only the options argument. ❤

    • @ScrapingNinja
      @ScrapingNinja  6 месяцев назад

      You are welcome, 🤗 I am glad you find this video useful, don’t forget to subscribe.

  • @dakshbhatnagar
    @dakshbhatnagar 5 месяцев назад +2

    This is still relevant in 2024. Definitely a helpful vid.; Btw what to do if the same is to be done locally? I am on MacOS

    • @ScrapingNinja
      @ScrapingNinja  5 месяцев назад

      Thanks man, and I think you can, i will check

  • @matei5054
    @matei5054 Год назад

    im getting this error: ls: cannot access '/usr/lib/chromium-browser/chromedriver/': Not a directory. There no files like you as in 5:42

    • @ScrapingNinja
      @ScrapingNinja  Год назад

      Where you are getting this error? Which line of code?

    • @matei5054
      @matei5054 Год назад

      @@ScrapingNinja im executing on google colab

    • @ScrapingNinja
      @ScrapingNinja  Год назад

      You can completely remove the executable path argument

  • @muhammadrafi4766
    @muhammadrafi4766 Год назад +1

    excuse me, i wanna ask.. why the data is not come out. i mean all code is run executed green.. but the output is wont go out.. ?? any answer please

    • @ScrapingNinja
      @ScrapingNinja  Год назад

      Try to follow step by step, double check the xpath, make sure you are printing the output, also update the xpath to make sure it’s upto date with website.

  • @mohdwasi1769
    @mohdwasi1769 Год назад +1

    Hi! How should i tackle the problem that says' execuatable_path is not defined'

    • @ScrapingNinja
      @ScrapingNinja  Год назад +1

      If you are using the colab you dont need to use this and if you aren’t you have typo its supposed to be executable_path

  • @nayeemuddinkhan5852
    @nayeemuddinkhan5852 Год назад

    Great video.I has been 2 days I have been looking for this solution. JajakAllah Khairan.

    • @ScrapingNinja
      @ScrapingNinja  Год назад +1

      I am glad you find this helpful don’t forget to subscribe..

    • @nayeemuddinkhan5852
      @nayeemuddinkhan5852 Год назад

      @@ScrapingNinja already did

    • @nayeemuddinkhan5852
      @nayeemuddinkhan5852 Год назад

      @@ScrapingNinja It would be of great help, if you give tutorials about social media scraping (twitter, facebook, Instagram etc)

    • @ScrapingNinja
      @ScrapingNinja  Год назад

      good idea...

  • @motivationThrive1011
    @motivationThrive1011 Год назад +1

    superr bro its working i have searched lot of videos it not working in google colab your code is working bro thanks

    • @ScrapingNinja
      @ScrapingNinja  Год назад

      You are welcome 🙏 i am glad you liked the video..

  • @viewing_person
    @viewing_person Год назад

    Please help, I keep getting this issue: TypeError: WebDriver.__init__() got multiple values for argument 'options'
    I have selenium 4.12.0

    • @ScrapingNinja
      @ScrapingNinja  Год назад

      you are probably passing more than one arguments the options are supposed to be like this.. webdriver.Chrome(options=options)

    • @DuyenLe-vs6xl
      @DuyenLe-vs6xl Год назад

      @@ScrapingNinja Please help, I got the same error, I wrote exactly like your tutorial. Thank you very much.
      here is the code:
      options = webdriver.ChromeOptions()
      options.add_argument('--no-sandbox')
      options.add_argument('--headless')
      options.add_argument('--disable-gpu')
      options.add_argument('--disable-dev-shm-usage')
      d = webdriver.Chrome('/usr/lib/chromium-browser/chromedriver', options = options)
      error:
      TypeError Traceback (most recent call last)
      in ()
      6 options.add_argument('--disable-dev-shm-usage')
      7
      ----> 8 d = webdriver.Chrome('/usr/lib/chromium-browser/chromedriver', options = options)
      TypeError: WebDriver.__init__() got multiple values for argument 'options'

    • @ScrapingNinja
      @ScrapingNinja  Год назад

      Hi Duyen your d=webdriver part is not correct please check the video or blog again

  • @SandeepVarun47
    @SandeepVarun47 Год назад

    I have followed the steps but it says webdriver__init__() got unexpected keyword argument ‘executable_path’. I even tried using another notebook but same

    • @ScrapingNinja
      @ScrapingNinja  Год назад

      watch ruclips.net/video/VSO14hgo6Gs/видео.html its latest.. new version doesn't need executable_path

  • @churagajyu5100
    @churagajyu5100 8 месяцев назад

    This is awesome! Thank you :) Could you make a tutorial how to get job description info from indeed?

    • @ScrapingNinja
      @ScrapingNinja  8 месяцев назад

      Thanks.. 🙏 i will try to make one but you can do it yourself by using either selenium or playwright and get the details from any website.

    • @churagajyu5100
      @churagajyu5100 8 месяцев назад

      @@ScrapingNinja I tried it but the hard part is to getting the right div id or class. I am not getting any result when I do something like this.
      job_descriptions = driver.find_elements(By.XPATH, '//div[@class="jobsearch-jobDescriptionText"]')

    • @ScrapingNinja
      @ScrapingNinja  8 месяцев назад

      Make sure the content is loaded before you search for this. Also in inspect element press ctrl+f and past your xpath “without inverted commas” there and it will show you if your xpath is correct and locats the element

  • @puteriananditya1935
    @puteriananditya1935 3 месяца назад

    i use this to scrape google maps reviews, but it return in chinese 😵‍💫, also does Google Colab really not display pop ups?

    • @ScrapingNinja
      @ScrapingNinja  3 месяца назад

      Open whatsmyip website in colab and check where your colab ip is located, colab runs on servers and yours probably located in china.

  • @mohitshrivastav2783
    @mohitshrivastav2783 Год назад +1

    Sir, thanks a lot for making this video. I've one query that can I use google colab in my android phone and then use selenium. Will it work ?

    • @ScrapingNinja
      @ScrapingNinja  Год назад +1

      Yes it should work fine because even if you are using it on mobile the backend os is same..

  • @sup5356
    @sup5356 Год назад

    Thank you so so much. So clear, so concise. Google documentation sucketh. Hard.

    • @ScrapingNinja
      @ScrapingNinja  Год назад

      You are welcome.. :) don't forget to subscribe

  • @animeshroy7301
    @animeshroy7301 6 месяцев назад

    i am getting this error "'str' object has no attribute 'capabilities'"
    please help

    • @ScrapingNinja
      @ScrapingNinja  6 месяцев назад

      Check to make sure you have correctly imported options and its not a string

  • @AlexeyZubkov
    @AlexeyZubkov Год назад +1

    How about headfull!?

    • @ScrapingNinja
      @ScrapingNinja  11 месяцев назад +1

      Colab is linux based environment so headful is not going to work.

  • @verissimobortolin6353
    @verissimobortolin6353 Год назад

    Thank you very much!!

    • @ScrapingNinja
      @ScrapingNinja  Год назад

      You're welcome! don't forget to subscribe

  • @ivanguedes4483
    @ivanguedes4483 Год назад

    excelent. iam brasil. Is possible to have interactions by elements of page, click, write, etc... for selenium colab?

    • @ScrapingNinja
      @ScrapingNinja  Год назад

      Yes all the tasks are possible as we do in selenium..

  • @aboutMindseta7607
    @aboutMindseta7607 Год назад +2

    NameError: name 'webdriver' is not defined

    • @ScrapingNinja
      @ScrapingNinja  Год назад

      You need to import webdriver first
      from selenium import webdriver

    • @kingki1953
      @kingki1953 Год назад

      nameerror is mostly because you forgot to define something. It's cause by undefined variable or you miss to import library or incorrect recall variable/library

    • @sweela1
      @sweela1 6 месяцев назад

      Is ka solution kia hai?

  • @boletgros
    @boletgros Год назад +1

    dont work no more it says version is outdated

    • @ScrapingNinja
      @ScrapingNinja  Год назад

      you need to install again.. follow steps in new notebook

  • @SaleheJavaheri
    @SaleheJavaheri Год назад

    nice. thank you so much

    • @ScrapingNinja
      @ScrapingNinja  Год назад

      You are most welcome, don't forget to subscribe

  • @vishvajitviswanathan7970
    @vishvajitviswanathan7970 Год назад

    Driver.maximize window means, it has to pop a new window but it's not showing

    • @ScrapingNinja
      @ScrapingNinja  Год назад

      its to maximize the current window

    • @vishvajitviswanathan7970
      @vishvajitviswanathan7970 Год назад

      @@ScrapingNinja but it's not opening the window, a new window has to appear, Like a new chrome page

    • @ScrapingNinja
      @ScrapingNinja  Год назад

      to open you need to
      driver = webdriver.Chrome()

  • @nicolasfernandez5256
    @nicolasfernandez5256 Год назад +1

    Where is the link?

  • @fatimahabib1431
    @fatimahabib1431 Год назад +1

    Thanks you so much, your tutorial is straightforward. I have a question, now
    -I installed chromium-browser using !apt-get install -y chromium-browser.
    -Then I run !ls/usr/lib/,
    however I could not find chromium-browser in the list of libraries, is it normall, could i find it in other directory ?

    • @ScrapingNinja
      @ScrapingNinja  Год назад +2

      It could be at another directory try
      !which chromium-browser
      and it will tell you if its installed and where

  • @mehdismaeili3743
    @mehdismaeili3743 Год назад

    Excellent.

    • @ScrapingNinja
      @ScrapingNinja  Год назад

      Thank you! Cheers! don't forget to subscribe

  • @AzharAli-cr2vj
    @AzharAli-cr2vj Год назад

    Executable_path error is showing

    • @ScrapingNinja
      @ScrapingNinja  Год назад

      Follow the code step by step if you still get the error create new colab notebook and follow the steps again.

  • @juanwoodcock5217
    @juanwoodcock5217 8 месяцев назад

    Thanks a lot. +1 like +1 subs