首页 > 解决方案 > while循环可以用其他while循环打印小时吗?

问题描述

我有机器人女巫正在使用 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 = 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...]

我的代码可以打印发送密钥的日期和时间吗?

标签: pythonseleniumautomationbots

解决方案


推荐阅读