有没有人尝试过使用redactor进行自动化测试?我对browser.click()有个问题。它不会点击我想让它点击的按钮。粗体、斜体或下划线按钮。有人能帮我吗?
下面的附图显示了开发工具中的DOM元素。在我的定位器中,例如。对于粗体,我使用了('.red-bold').click();

发布于 2016-05-22 07:38:32
你的代码可能有问题。在任何情况下,下面是一个示例代码,它选择redactor editor中的所有文本,单击工具栏中的"B“按钮,将所有文本设置为粗体:
describe("Redactor demo test", function () {
var editor;
beforeEach(function () {
var EC = protractor.ExpectedConditions;
browser.ignoreSynchronization = true;
browser.get("https://imperavi.com/redactor/");
// wait for the redactor editor to become visible
editor = $(".redactor-editor");
browser.wait(EC.visibilityOf(editor), 5000);
});
it("should make the text bold", function () {
// select all text in the editor
editor.click();
editor.sendKeys(protractor.Key.COMMAND, "a");
// click "bold"
var toolbar = $(".redactor-toolbar");
toolbar.$(".re-bold").click();
browser.sleep(30000); // the delay is for you to see it becomes bold
// TODO: expectations
});
});https://stackoverflow.com/questions/37336060
复制相似问题