Skip to main content
2 de 2
se añadieron 10 caracteres en el cuerpo
Israel-ICM
  • 3.6k
  • 25
  • 20
  • 26

Me sale el error: IndentationError: expected an indented block (PYTHON)

#bot

from selenium import webdriver
from time import sleep
PATH = '/users/nombre/documents/python/chromedriver'

class bot(videoName, watchtime):
    def __init__(self):
       self.browser = webdriver.Chrome(PATH)
    
    def __home(self):
       self.browser.get("https://www.youtube.com/channel/UCqEUmSIH4fjjtwqGz4zLk_g?view_as=subscriber")
       sleep(2)

    def __videoPageID(self, elementNumber):
       self.ids = self.browser.find_element_by_id('thumbnail')
       return self.ids[elementNumber]
       

    def watchVideo(self, videoNumber, watchTime):
           self.videoNumber = videoNumber
           self.watchTime = watchTime
           if self.videoTitle in keys(videosXPath):
           self.__home(self)
           thumbnailElm = self.__videoID(self.videoNumber)
           thumbnailElm.click()
           sleep(self.watchTime)
           if self.videoTitle in videosXPath.keys():
               thumbnailElem = self.browser.find_element_by_xpath(videosXPath[videoTitle])
               thumbnailElem.click()
               sleep(watchTime)

              
           
myBot = Bot()
for i in range(18)
    myBot.watchVideo('i, 2')