我是量角器的新手.任何人都可以指导我使用量角器进行数据驱动测试.下面是代码,配置文件和testdata.json文件.
'use strict';
var testData = require('../example/Test Data/Test.json');
describe('LoginPage', function() {
var loginData = require('../example/Test Data/Test.json');
testData.forEach(function (data) {
it("data.description", function (data) {
browser.get("http://127.0.0.1:8080/#/login");
element(by.model("username")).sendKeys(data.username);
element(by.model("password")).sendKeys(data.passwordField);
element(by.buttonText("Authenticate")).click();
});
});
});
Run Code Online (Sandbox Code Playgroud)
配置文件:
// An example configuration file.
exports.config = {
directConnect: true,
//seleniumAddress: 'http://localhost:4444/wd/hub',
// Capabilities to be passed to the webdriver instance.
capabilities: {
'browserName': 'chrome'
},
// Framework to use. Jasmine is recommended.
framework: 'jasmine',
// Spec patterns are relative to the current working directory when
// protractor is …Run Code Online (Sandbox Code Playgroud) 我无法在 Appium 中使用 xpath 包含和遵循策略。不知道Appium是否支持。API 级别 19。任何人都可以帮忙:我必须单击显示余额的文本视图,即。INR .....所以我正在使用
driver.findElement(By.xpath("//android.widget.TextView[contains(@name,'INR')]"));
and
driver.findElement(By.xpath("//android.widget.TextView[contains(text(),'INR')]"));
Run Code Online (Sandbox Code Playgroud)
但没有任何作用
我有一个上传,压缩和下载pdf文件的测试.除下载部分外,一切正常.当我们点击下载时,我无法获得如何处理Firefox中的确认弹出/保存或打开文件对话框.我尝试修改firefox配置但仍然无法解决它.有人可以帮忙吗?
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("browser.download.folderList", 2);
profile.setPreference("browser.download.manager.showWhenStarting", false);
profile.setPreference("browser.download.dir", "C:\\Users\\Sahil\\Downloads\\");
profile.setPreference("browser.helperApps.neverAsk.openFile","application/pdf");
profile.setPreference("browser.helperApps.neverAsk.saveToDisk","application/pdf");
profile.setPreference("browser.helperApps.alwaysAsk.force", false);
profile.setPreference("browser.download.manager.alertOnEXEOpen", false);
profile.setPreference("browser.download.manager.focusWhenStarting", false);
profile.setPreference("browser.download.manager.useWindow", false);
profile.setPreference("browser.download.manager.showAlertOnComplete", false);
profile.setPreference("browser.download.manager.closeWhenDone", false);
profile.setPreference("browser.download.manager.useWindow", false);
profile.setPreference("browser.download.manager.showWhenStarting", false);
profile.setPreference("services.sync.prefs.sync.browser.download.manager.showWhenStarting", false);
, 0 profile.setPreference("pdfjs.disabled", true);
WebDriver driver=new FirefoxDriver(profile);
driver.get("http://www.ilovepdf.com/compress_pdf");
driver.findElement(By.id("pickfiles")).click();
Runtime.getRuntime().exec("C:\\Users\\Sahil\\Documents\\Au\\Second.exe");
WebDriverWait wait=new WebDriverWait(driver, 100);
WebElement element1=wait.until(ExpectedConditions.elementToBeClickable(By.id("uploadfiles")));
element1.click();
WebElement element=wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("a#download")));
element.click();
Run Code Online (Sandbox Code Playgroud) 我是Protractor的新手.任何人都可以告诉我如何在Protractor中使用鼠标悬停,拖放(如硒中的动作)等操作.我只需要一个语法或代码片段.
selenium ×3
automation ×2
protractor ×2
android ×1
appium ×1
json ×1
testing ×1
testng ×1
xpath ×1