按钮不点击和得到没有错误与Selenium Python



这个按钮没有被点击

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

我尝试使用id,名称,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()

这个

chrome_options.add_argument("user-data-dir=C:\Users\Username\AppData\Local\Google\Chrome\User Data") # Stay LOGGED IN

谁能给我解释一下这个代码是如何工作的?它让我保持登录在网站

相关内容

  • 没有找到相关文章

最新更新