If you want to make pause after every search then you should use time.sleep after search(d)
import time
def get_keyword():
data = pd.read_excel('a.xlsx')
for d in data['name']:
search(d)
time.sleep(10*60) # 10min * 60s
If you want to make pause after every two searches then you have to count loops. And when you count to 2 then run time.sleep and reset counter.
import time
def get_keyword():
data = pd.read_excel('a.xlsx')
count_loops = 0
for d in data['name']:
search(d)
count_loops += 1
if count_loops == 2:
time.sleep(10*60) # 10min * 60s
count_loops = 0
If it has to behave more like human then you should use random time
import time
import random
if count_loops == 2:
minutes = random.randint(8, 12) # 8-12 minutes
time.sleep(minutes*60)
count_loops = 0
If you will countdown from 2 to 0 then you could even use random number of searches
import time
import random
def get_keyword():
data = pd.read_excel('a.xlsx')
count_loops = random.randint(1, 4)
for d in data['name']:
search(d)
count_loops -= 1
if count_loops == 0:
minutes = random.randint(8, 12) # 8-12 minutes
time.sleep(minutes*60) # 10min * 60s
count_loops = random.randint(1, 4)
implicitly_waitis only for waiting for element in HTML, not for pausing code. You have to usetime.sleep()for this.cronfor this.browser.implicitly_wait(10)once and it will remeber this value.implicitly_waitis used for website respond, time.sleep does not work well when I put after get_keyword funcsearch(d)- insidefor-loop. OR insidesearch(). It will create pause after every search. If you want to pause after two search then you will have use variable to count loops and when it is 2 then run sleep and reset count`