![]() |
|
Python Selenium Help - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Coding (https://sinister.ly/Forum-Coding) +--- Forum: Python (https://sinister.ly/Forum-Python) +--- Thread: Python Selenium Help (/Thread-Python-Selenium-Help) |
Python Selenium Help - Einsatzgruppe - 02-10-2021 i havent messed with it much so please dont judge me i wrote a program uses selemium gekodriver to auto scan dork list for urls than from scanned urls it passes to auto sqli vuln chcker and title cehcker . blah blah blah :/ it runs fine for while till google-cookie starts to fill and if i manual deleted the file it runs perfectly fine for an hour or so .. so long story short is there a way i can code it to auto clean google-cookie file out itself?? Or is that impossible ? from the basic research i did everyone just said introduce a sleep witch yes in the short run it will have an impact but the file will still fill up just will take longer and ill be stuck in the same boat (Sorry if this isnt the correct section or correct format to be asking ) RE: Python Selenium Help - DedSpace - 02-10-2021 (02-10-2021, 03:40 AM)Einsatzgruppe Wrote: so long story short is there a way i can code it to auto clean google-cookie file out itself?? Or is that impossible ? from the basic research i did everyone just said introduce a sleep witch yes in the short run it will have an impact but the file will still fill up just will take longer and ill be stuck in the same boat Hello. Since you do not want to use time.sleep() I would suggest something along the lines of: Code: from os import remove
try:
remove(path_to_file)
except OSError:
passThis is what I get when trying to delete a non existent file: Code: >>> from os import remove
>>> remove("12345.txt")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 2] No such file or directory: '12345.txt'
>>> try:
... remove("12345.txt")
... except OSError:
... pass
...
>>>Using the try and except is necessary is you do not want to wait for the file to be created or if you do not know how long it takes to be created after deleting. RE: Python Selenium Help - Einsatzgruppe - 02-10-2021 (02-10-2021, 12:54 PM)DedSpace Wrote:do you think in sleep ? im open to it if you think it should be added . Because 90% time its running in the background .. so id love for it to stay stable .. when first started it i kept getting stupid timeout sh*t -_- i was able to fix that .. But truly thank you soo much for helping me out <3 im about to try it out and will let you know the outcome!!!! again THANK YOU sooo much Sir(02-10-2021, 03:40 AM)Einsatzgruppe Wrote: so long story short is there a way i can code it to auto clean google-cookie file out itself?? Or is that impossible ? from the basic research i did everyone just said introduce a sleep witch yes in the short run it will have an impact but the file will still fill up just will take longer and ill be stuck in the same boat RE: Python Selenium Help - DedSpace - 02-10-2021 You don't have to use sleep if you have some sort of loop you can put the try and except in. Each iteration of the loop it will try to delete the file and if the file does not exist it will do nothing RE: Python Selenium Help - Einsatzgruppe - 02-11-2021 i have some other questions about python stuff would it be alright if i asked about and you could answer them when you have some free time ? RE: Python Selenium Help - DedSpace - 02-12-2021 (02-11-2021, 11:46 PM)Einsatzgruppe Wrote: i have some other questions about python stuff would it be alright if i asked about and you could answer them when you have some free time ? Of course. But perhaps you should open a new thread or PM me. RE: Python Selenium Help - valentine - 03-12-2022 u should use requests library or other libraries that arent selenium, selenium is rather weird to work with, requests is a lot easier RE: Python Selenium Help - mothered - 03-13-2022 This thread Is over a year old, and the OP has been banned. Obviously he/she Is not active to read replies to the said request. Thread closed. |