我正在为网站编写一个小型测试脚本,作为测试的一部分,程序需要单击按钮。我正在使用谷歌浏览器驱动程序,我尝试了一些功能,例如:driver.findElement(By.cssSelector()) driver.findElements(By.xpath()) 但由于某种原因程序无法识别定位器。
在图像中,我选择了一个按钮来获取其 id 或类 (对不起,该网站是希伯来语的)。
Main RunnerClass
package runners;
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(features = { "src/test/java/featurefiles/" }, glue = {
"stepDefinitions" }, monochrome = true, tags = {},
plugin = { "pretty", "html:target/cucumber",
"json:target/cucumber.json",
"com.cucumber.listener.ExtentCucumberFormatter:output/report.html" })
public class MainRunner {
}
特征文件
Feature: consume product through sales section.
Scenario: payment form will display after assembling a product.
Given I access pizzahut.co.il
When I click on sales section button
And I click on add family non gluten pizza button
And I click on add button
And I click on chosen extra
And I click on extra for the whole pizza
And I click on choose and next button
And I click on continue for payment allert button
And I click on continue for payment button
Then I should successfully be moved to the payment form
慕容3067478
慕桂英4014372
相关分类