Automation 如何使用量角器访问弹出窗口中的文本框

Automation 如何使用量角器访问弹出窗口中的文本框,automation,protractor,Automation,Protractor,请某人帮助我使用量角器访问弹出窗口中的文本框 <div class="ngdialog-content"> <div class="ngdialog-message ngdialogCustomStyle"> <h3 class="dailog-title">Create New </h3> <div class="div_emailTo"> <input class="input_textbox" type="text" pla

请某人帮助我使用量角器访问弹出窗口中的文本框

<div class="ngdialog-content">
<div class="ngdialog-message ngdialogCustomStyle">
<h3 class="dailog-title">Create New </h3>
<div class="div_emailTo">
<input class="input_textbox" type="text" placeholder="To">
<a class="cc-link" ng-click="show_cc=true" ng-show="!show_cc" href="#">cc</a>
</div>
<div class="ng-hide" ng-show="show_cc">
<div>
<div>
<div id="attachBtn" class="attachDocBtnContainer" ng-click="uploadBtnClick()">
<input id="browse_file" class="attachDocBrowser" type="file">
<div class="emailDialogBtns">
</div>
<div class="ngdialog-close"></div>
</div>
</div>

创造新的

试试这个:

describe('Protractor Demo', function() {
it('should greet the named user', function() {    
    var emailTo = element(by.css('.div_emailTo'));
    var txtbox = emailTo.element(by.css('.input_textbox'));
    txtbox.sendKeys('***************');
  });
 });

如果它真的是一个真正的弹出窗口,那么这个有用的功能就可以派上用场

/**
 *[selectWindow Focus the browser to the index window.
 * @param  {[Object]} index [Is the index of the window. E.g., 0=browser, 1=FBpopup]
 * @return {[!webdriver.promise.Promise.<void>]}
 */
global.selectWindow = function(index) {
  // wait for handles[index] to exist
  browser.wait(function() {
    return browser.getAllWindowHandles().then(function(handles) {
      /**
       * Assume that handles.length >= 1 and index >=0.
       * So when calling selectWindow(index) return
       * true if handles contains that window.
       */
      if (handles.length > index) {
        return true;
      }
    });
  }, 30000);
  // here i know that the requested window exists

  // switch to the window
  return browser.getAllWindowHandles().then(function(handles) {
    return browser.switchTo().window(handles[index]);
  });
};

请分享你的代码,以便我们了解具体情况。你说的是什么类型的弹出窗口?这些是默认弹出窗口(通过alert或confirm),还是用HTML编写的弹出窗口?
// select the pop window
selectWindow(1);
// Do stuff with the text input 
element(by.css(".input_textbox").sendKeys("something");
// Interact back with the browser and no longer with the popup
selectWindow(0);