Python 如何让pyautogui在google中键入链接,以及在用户决定的次数上循环?
我正在运行这段代码,但它没有键入kahoot链接,它只是键入了chrome。代码如下:Python 如何让pyautogui在google中键入链接,以及在用户决定的次数上循环?,python,libraries,Python,Libraries,我正在运行这段代码,但它没有键入kahoot链接,它只是键入了chrome。代码如下: import pyautogui as gui import random gui.FAILSAFE = False pin = input('What is the kahoot code? ') name = input('Pick a bot name, no numbers. ') nums = input('Select the amount of bots. Maximum 100. ') a =
import pyautogui as gui
import random
gui.FAILSAFE = False
pin = input('What is the kahoot code? ')
name = input('Pick a bot name, no numbers. ')
nums = input('Select the amount of bots. Maximum 100. ')
a = str(list(range(100)))
gui.move(-1000, 1000)
gui.click()
gui.write('Chrome')
gui.press('Enter')
for num in nums:
x = random.choice(a)
gui.write('Kahoot.it')
gui.press('Enter')
gui.write(pin)
gui.press('Enter')
gui.write(name + x)
gui.press(enter)
gui.keyDown('ctrl')
gui.keyDown('t')
gui.keyUp('ctrl')
gui.keyUp('t')
当
pyautogui
开始编写时,可能没有加载Chrome navigator。你应该使用time.sleep
在Chrome加载时稍等片刻。但是,如果您想使用navigator,我认为应该使用selenium
包,因为它可以比pyautogui
更精确地操作它
希望对您有所帮助。可能在
pyautogui
开始编写时没有加载Chrome navigator。你应该使用time.sleep
在Chrome加载时稍等片刻。但是,如果您想使用navigator,我认为应该使用selenium
包,因为它可以比pyautogui
更精确地操作它
希望对你有帮助