Python while循环能否与其他while循环一起打印小时数?
我有一个机器人,它正在使用selenium为我实现自动化。我有计数器,但我也需要日期,我的代码是:Python while循环能否与其他while循环一起打印小时数?,python,selenium,automation,bots,Python,Selenium,Automation,Bots,我有一个机器人,它正在使用selenium为我实现自动化。我有计数器,但我也需要日期,我的代码是: from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.action_chains import ActionChains import time import datetime i = 1 actions = Action
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
import time
import datetime
i = 1
actions = ActionChains(OMS)
now = datetime.datetime.now()
while i <= amount:
time.sleep(1)
bot.find_element_by_class_name('classname').click()
actions.send_keys("Lorem ipsum dolor sit amet, consectetlerisque." + Keys.RETURN)
actions.perform()
time.sleep(3)
print(i)
print(str(now))
i = i + 1
OMS.description(500)
**output:**
[1
2020 11 9 13 30 9
[2
2020 11 9 13 30 9
[3
2020 11 9 13 30 9
[4
2020 11 9 13 30 9...]
从selenium导入webdriver
从selenium.webdriver.common.keys导入密钥
从selenium.webdriver.common.action\u链导入ActionChains
导入时间
导入日期时间
i=1
动作=动作链(OMS)
now=datetime.datetime.now()
虽然iamount
是未定义的。好的,谢谢,我忘记粘贴那行了。只需将now放入循环中,它就会自动递增。点击后()。@arundeepchohan谢谢你!