【发布时间】:2021-01-17 16:05:31
【问题描述】:
this buttons are not getting clicked
agree_button = driver.find_element_by_xpath('//*[@id="rightsDeclaration"]')
submit = driver.find_element_by_xpath('//*[@id="submit-work"]')
def upload():
agree_button.click()
time.sleep(1)
submit.click()
upload():
但是我注意到,当函数被调用时,url 会像这样被选中:
Url selected when the function is called
我尝试使用 id、name、xpath 和所有内容进行定位
按钮:
我还注意到页面向下滚动了一点(而不是单击 ofc),就是这样。有什么问题?
完整代码:
copy_settings_link = "https://www.redbubble.com/portfolio/images/68171273-only-my-dog-understands-me-beagle-dog-owner-gift/duplicate"
def copy_settings():
driver.get(copy_settings_link)
replace_image_button = driver.find_element_by_xpath('//*[@id="select-image-base"]')
time.sleep(1)
replace_image_button.send_keys(Path_list[0])
upload_check = driver.find_element_by_xpath(
'//*[@id="add-new-work"]/div/div[1]/div[1]/div[1]/div') # CHECKING UPLOAD
while True:
if upload_check.is_displayed() == True:
print('Uploading...')
time.sleep(1)
else:
print('Uploading Finished')
time.sleep(1)
break
copy_settings()
def upload():
agree_button.click()
time.sleep(1)
submit.click()
upload()
【问题讨论】:
标签: python python-3.x selenium selenium-webdriver selenium-chromedriver