Reputation: 51
please some one help me to access the textboxes in the POP UP window using 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" 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>
Upvotes: 0
Views: 2759
Reputation: 1197
if it's truly an actual pop-up window then this helpful function can come in handy.
/**
*[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]);
});
};
as it's explained in the comments 1 would be the popup window and 0 would be back to the browser so you could have a scenario like so:
// 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);
Upvotes: 1
Reputation: 4195
Try this:
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('***************');
});
});
Upvotes: 1