1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Can phython with selenium be minimized?

Discussion in 'Programming' started by EagerToEarn, Jun 9, 2017.

  1. EagerToEarn

    EagerToEarn Regular Member

    Joined:
    Jun 4, 2017
    Messages:
    384
    Likes Received:
    96
    Gender:
    Male
    (Optional Paragraph) I am learning phython but before learning I was decided to go Java(and straight up no to 'C' oriented programming cuz Java is still easier, I want to choose EASY language first)
    I know, #c is boss but I want programming just for like bots,web design,etc.


    Phython suits for my needs. But hearing that while using selenium(kinda slow) you CANT MINIMIZE.
    Bots is needed to be minimized most of the time.

    I heard that you can resize selenium web browser to small size that will hide the window.
    Does losing focus on the web browser stops it? And can I run 10 to 8 RESIZED selenium web browser without compromising anything inside selenium.
     
  2. GoDesain

    GoDesain Regular Member

    Joined:
    Feb 26, 2011
    Messages:
    480
    Likes Received:
    198
    From my exp, never know if python selenium have minimize function while running..
    "driver.set_window_position(x, x)" <== Only move
    but try to watch phantomjs.. "webdriver.PhantomJS()"
    if your bot can run without javascript interaction.. maybe scrapy or mechanize will suit for you..

    maybe other python expert on bhw have good exp then me.. can give you other suggestion..
     
  3. EagerToEarn

    EagerToEarn Regular Member

    Joined:
    Jun 4, 2017
    Messages:
    384
    Likes Received:
    96
    Gender:
    Male
    Thank you very much. I know about phantomjs have JavaScript problem. Will check scrapy and mechanize.

    Consider if Making (selenium+phython+Firefox) webdriver not active window(I mean this webdriver window is in running background) and Like if it is out of screen sight,will have any negative effect on the bot I'm running?

    can I run more than one webdriver with different .py program? Sorry this is stupid question.

    I'm no expert just wanted to before getting deep into phython. I'm thankful will always remember you in the future.
     
  4. GoDesain

    GoDesain Regular Member

    Joined:
    Feb 26, 2011
    Messages:
    480
    Likes Received:
    198
    I'm not really expert in selenium, but for your question about effect. As i know selenium only can run if windows in active mode. it's no problem if in your view screen or out screen.
    but i hear combine with diferrent python module will make better.
    about effect.. i think only if you run selenium with multiple session..you will need more resource.
    about 1 webdrive with different py, yes.. but better if you make 1 script handle different function with multiple session.

    already create sample case using scrapy if you want :
    https://www.blackhatworld.com/seo/create-simple-python-scraper-bot-with-scrapy.946490/
     
  5. atosz33

    atosz33 Junior Member

    Joined:
    Jun 2, 2012
    Messages:
    132
    Likes Received:
    70
    Location:
    Hungary, Eger
    Home Page:
    Use requests instead of selenium, its much faster and headless.
     
  6. masush300

    masush300 Jr. VIP Jr. VIP Premium Member

    Joined:
    Mar 16, 2012
    Messages:
    1,091
    Likes Received:
    344
    Occupation:
    Coding
    Location:
    Imagine Dragons
    Home Page:
    use windows position -2000 - 2000

    it works for me,

    some tips,
    You can:
    Hide logging windowing
    use invisible browser (headless) with all same code (but i havent tried it yet because i was working with facebook bot)
     
  7. atosz33

    atosz33 Junior Member

    Joined:
    Jun 2, 2012
    Messages:
    132
    Likes Received:
    70
    Location:
    Hungary, Eger
    Home Page:
    Don't use selenium.. Its such a hell for your comp's memory. With requests xou could make even 5-10 threads with diff proxies.
     
  8. Buzzika

    Buzzika Senior Member

    Joined:
    Jul 8, 2009
    Messages:
    1,197
    Likes Received:
    1,481
    Occupation:
    Hustler
    Location:
    Gurgaon
    selenium is cool for rapid dev when you are looking for a quick fix solution for your automation needs.

    and not all websites can be automated in a headless environment with ease.

    also we have huge memory on most systems these days, never felt I was low on ram so far when using selenium for my custom made IM bots.
     
  9. Ignatius O

    Ignatius O Registered Member

    Joined:
    Jun 27, 2016
    Messages:
    64
    Likes Received:
    4
    Gender:
    Male
    I am a python programmer but I think requests does not handle javascripts and selenium + python + firefox needs a lot of resource.

    Is there any other module that handles javascript very well and is lightweight?
     
  10. Ignatius O

    Ignatius O Registered Member

    Joined:
    Jun 27, 2016
    Messages:
    64
    Likes Received:
    4
    Gender:
    Male
    How do you use request to handle pages with javascript
     
  11. atosz33

    atosz33 Junior Member

    Joined:
    Jun 2, 2012
    Messages:
    132
    Likes Received:
    70
    Location:
    Hungary, Eger
    Home Page:
    In my experience there is one site which you can't automate with requests, that pinterest. You don't need all js scripts to run. I made many bots with requests, twitter, tumblr, xvideosuploaddr, xhamsterdownloader, and i didnt have any problem with js scripts, on the other hand you could bypass js logins and etc with connect selenium with requests, all you need to do is pass cookies from selenium to requests, and close selenium to not to slow your pc.
     
    • Thanks Thanks x 1
  12. Ignatius O

    Ignatius O Registered Member

    Joined:
    Jun 27, 2016
    Messages:
    64
    Likes Received:
    4
    Gender:
    Male
    ok thanks
     
  13. Ignatius O

    Ignatius O Registered Member

    Joined:
    Jun 27, 2016
    Messages:
    64
    Likes Received:
    4
    Gender:
    Male
    how do you view browser requests when programming bots Wirth python requests? If you use any app in viewing the request please name it here.
     
  14. atosz33

    atosz33 Junior Member

    Joined:
    Jun 2, 2012
    Messages:
    132
    Likes Received:
    70
    Location:
    Hungary, Eger
    Home Page:
    Chrome's developer mode networking tab
     
  15. Ignatius O

    Ignatius O Registered Member

    Joined:
    Jun 27, 2016
    Messages:
    64
    Likes Received:
    4
    Gender:
    Male
    Thanks
     
  16. DestinyInfinity

    DestinyInfinity Jr. VIP Jr. VIP

    Joined:
    Oct 3, 2016
    Messages:
    153
    Likes Received:
    54
    Gender:
    Female
    Location:
    Germany, Europe
    @atosz33
    Can you also automate Facebook just with requests? Or do you need an open browser and selenium for doing all the actions on the webelements (clicking, writing, ...)?
     
  17. atosz33

    atosz33 Junior Member

    Joined:
    Jun 2, 2012
    Messages:
    132
    Likes Received:
    70
    Location:
    Hungary, Eger
    Home Page:
    I think it could be fully automated with requests. Nearly all site could be automatised with it, i built many bots twitter, tumblr, xvideos xhamster, so probably facebook easily can be done
     
  18. knaitas

    knaitas Junior Member

    Joined:
    Jul 26, 2016
    Messages:
    154
    Likes Received:
    124
    Gender:
    Male
    Home Page:
    8gb ram pc with 4 core i5 somewhat newer cpu can run about 15 selenium bots at once
     
  19. atosz33

    atosz33 Junior Member

    Joined:
    Jun 2, 2012
    Messages:
    132
    Likes Received:
    70
    Location:
    Hungary, Eger
    Home Page:
    Then? And can about 200-500 instances of requests, requests alway headless ( ok I know there is phantomjs but that have limitations). And selenium have high error rate if you use your computer. I know, i am working at an IT company and our main job to automate and test sites
     
  20. knaitas

    knaitas Junior Member

    Joined:
    Jul 26, 2016
    Messages:
    154
    Likes Received:
    124
    Gender:
    Male
    Home Page:
    true, but for bot making selenium is very handy, because it looks like a real human is interacting with the website/app