driver.get('url')
#login
driver.find_element_by_xpath('//*[@id="input-username"]').send_keys('username')
driver.find_element_by_xpath('//*[@id="input-password"]').send_keys('password')
driver.find_element_by_xpath('//*[@id="content"]/div/div/div/div/div[2]/form/div[3]/button').click()
'''selecting supplier and modifying the content from drop down list'''
def select_supplier():
driver.find_element_by_xpath('//*[@id="seller_id"]').click()
driver.find_element_by_xpath('//*[@id="seller_id"]/option[2]').click()
time.sleep(1.0)
#select supplier from the drop down list (The tick)
driver.find_element_by_xpath('//*[@id="ms-bulk-sel-apply"]').click()
#Select all products
driver.find_element_by_class_name('sorting_disabled').click()
driver.find_element_by_xpath('//*[@id="ms-bulk-sel-apply"]').click()
time.sleep(2.0)
# def select_all_products():
# driver.find_element_by_xpath('//*[@id="list-products"]/thead/tr[1]/td[1]/input').click()
#clicking next
def click_next():
driver.find_element_by_xpath('//*[@id="list-products_next"]').click()
def number_clicks(times, select_supplier, click_next):
for i in range(times):
select_supplier()
click_next()
number_clicks(53, select_supplier, click_next)
Я автоматизирую действие на своем веб-сайте, где я выбираю список продуктов и приписываю их конкретному поставщику.Я могу войти в систему и выполнить логику, однако он выполняет только первые 2 страницы, а затем возвращается на 1-ю страницу и снова выполняет ту же функцию.