15
15
sys .path .append (r'C:\Users\eddyizm\Source\repo\twitterbot/' )
16
16
from post_image import tweet_photos , tweepy_creds , search_twtr , fave_tweet
17
17
pyautogui .FAILSAFE = False
18
- # crontab for bash script:
19
- # 07 7 * * 1-7 export DISPLAY=:0; /home/eddyizm-hp/Documents/insta_delete/upload.sh >> /home/eddyizm-hp/HP/upload.log
20
18
21
19
22
20
if os .name == 'nt' :
23
21
logintext = r'C:\Users\eddyizm\Desktop\Work\login.txt'
24
- firefoxPath = r'C:\Users\eddyizm\Source\Repos\InstaPy\assets \geckodriver.exe'
22
+ firefoxPath = r'C:\Users\eddyizm\Source\Repos\seleniumTesting\env \geckodriver.exe'
25
23
image_path = r'C:\Users\eddyizm\HP\images'
26
24
desk_profile = r'C:\Users\eddyizm\AppData\Roaming\Mozilla\Firefox\Profiles\nljvmxt1.default'
27
25
else :
@@ -52,8 +50,7 @@ def get_images(folder : str):
52
50
53
51
54
52
def return_randomtime ():
55
- #return randrange(25,60)
56
- return randrange (10 ,30 )
53
+ return randrange (25 ,60 )
57
54
58
55
59
56
def login_to_site ():
@@ -111,15 +108,17 @@ def upload_image(browser_object : str, filepath : str):
111
108
ActionChains (browser_object ).move_to_element (options_button ).click ().perform ()
112
109
time .sleep (return_randomtime ())
113
110
print ('selecting file on local file system' )
111
+ # browser_object.save_screenshot("selectingfile.png")
114
112
pyautogui .write (filepath , interval = 0.25 )
115
113
pyautogui .press ('return' )
116
114
pyautogui .press ('enter' )
115
+ # browser_object.save_screenshot("lookingforOpenBTN.png")
117
116
btn = pyautogui .locateOnScreen ('screenshots/open.png' )
118
117
if btn :
119
118
top = (btn [0 ] + (btn [2 ]/ 2 ))
120
119
bottom = (btn [1 ] + (btn [3 ]/ 2 ))
121
120
pyautogui .click (x = top , y = bottom )
122
- print ('file pushed to browser. now to resize and add the tags.' )
121
+ print ('file pushed to browser... add the tags.' )
123
122
time .sleep (30 )
124
123
return browser_object
125
124
except Exception as ex :
@@ -188,5 +187,5 @@ def main():
188
187
continue
189
188
190
189
if __name__ == '__main__' :
191
- # time.sleep(randrange(1,3000))
190
+ time .sleep (randrange (1 ,3000 ))
192
191
main ()
0 commit comments