硒,单击没有id python的提交按钮 [英] Selenium, click submit button with no id python

查看:56
本文介绍了硒,单击没有id python的提交按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力寻找一种方法来单击以下课程中的提交"按钮.它不包含ID,名称或任何不是动态生成的易于识别的方法.任何帮助表示赞赏.

I'm struggling to figure a way to click the submit button in the following class. It does not contain an ID, name, or any easily identifiable method that is not dynamically generated. any help is appreciated.

到目前为止,我已经尝试过:

so far i have tried:

driver.find_element_by_xpath("//div[@class='button-status-container'][@type='submit']")

driver.find_element_by_xpath("//div[@class='button-status-container']//button-status-container[@type='submit']")

driver.find_element_by_css_selector('.button-status-container[type="button"]')

以上所有错误均通过 NoSuchElementException 排除.提交按钮的htlm

all of the above errors out with NoSuchElementException. the htlm of submit button

推荐答案

我认为正确的xpath/css选择器应为:

I think the correct xpath/css selector should be:

driver.find_element_by_xpath("//div[@class='button-status-container']/button[@type='submit']")

driver.find_element_by_css_selector('.button-status-container > [type="button"]')

这篇关于硒,单击没有id python的提交按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆