使用ruby和selenium webdriver如何从“容器”中获取课程?(Using ruby and selenium webdriver how I can get class from “container”?)

我有以下表格:

<div id="PaymentInfoDivContainer" class="checkout-section-container complete"> <div class="checkout-section"> <h3 class="sheen"> <span class="step">2</span> Payment Information </h3> <a class="sc-button-white edit-button" onclick="SC.Checkout.Edit(this);" href="javascript:;">Edit</a> <div class="checkout-section-content"> </div>

使用Ruby和selenium webdriver,我如何获得(并点击)“编辑按钮”类? 据我所知,我必须得到并存储在变量id =“PaymentInfoDivContainer”中,然后用它来找到合适的类。 有什么想法/想法吗?

谢谢

I have the following form:

<div id="PaymentInfoDivContainer" class="checkout-section-container complete"> <div class="checkout-section"> <h3 class="sheen"> <span class="step">2</span> Payment Information </h3> <a class="sc-button-white edit-button" onclick="SC.Checkout.Edit(this);" href="javascript:;">Edit</a> <div class="checkout-section-content"> </div>

Using Ruby and selenium webdriver, how I can get (and click) on "edit-button" class ? As I understand I have to get and store in variable id="PaymentInfoDivContainer" and then use it to find the right class. Any thoughts/ideas?

Thanks

最满意答案

好的,您可以按如下方式进行操作: CSS3 [attribute $ = value]选择器

driver.find_element(:css,'a[class$="edit-button"]').click

要么

driver.find_element(:css,'div#PaymentInfoDivContainer>div>a').click

Okay,You can go as below : CSS3 [attribute$=value] Selector

driver.find_element(:css,'a[class$="edit-button"]').click

or

driver.find_element(:css,'div#PaymentInfoDivContainer>div>a').click

更多推荐