casperjs cant click popup - popup

My code:
casper.waitForSelector('.single_like_button.btn3-wrap .btn3',
function success() {
this.click('.single_like_button.btn3-wrap .btn3');
}
);
Returned:
TypeError: 'undefined' is not an object (evaluating 'window.angular.version')
https://s.ytimg.com/yts/jsbin/www-en_US-vfl2odRpD/angular_base.js:167
https://s.ytimg.com/yts/jsbin/www-en_US-vfl2odRpD/angular_base.js:225
the button when clicked, will open a second tab window, like a popup,
when the second window finished its works, it will close automatically and transfer data back to 1st window.
I dont know if this process had used angular js?
and do i need to install angularjs and how?
beacuse the error seemed related to angularjs
the popup url is inside a javascript's function, i dont know how to scrape it
I dont get the popup url, so i dont know how to use "waitforpopup"
but even if i can get the url, i still have to click the button in order to the correct data transfer. I have used clickLabel("Subscribe", div) , also not working.
Any advices?

I've had issues with waitForSelector before.. Although I'm not familiar with your html/js, why not try the following in place of your code above to do a quick sanity check. This will give you a better idea of what's happening.
this.wait(5000,function(){ // use wait (5 secs) instead of waitForSelector
// log the el to see if it exists at this point
console.log($('.single_like_button.btn3-wrap .btn3').length + " els found");
// click dat
this.click('.single_like_button.btn3-wrap .btn3');
});

Related

Click button is not working in protractor

I am new to angular world. I am in process of automating the angular 2
application but I am having hard time to click a button.
Options tried:
I used various selectors like xpath, CSS, buttonText but none of them is working, s/m throws a timeout message or unable to find a selector.
When I try to print the element in console it is displaying as object object.
Do I need to return the value in format of string and then attempt to click?
Or
Do I need to add any require plug in from NPM ? Please let me know
script snippet:
var resubmit=element.all(by.xpath("//BUTTON[#_ngcontent=''][text()='resubmit']")).get('0');
console.log("return"+resubmit);
resubmit.click();
Wait untill element is become clickable and then click. You do it by following:
EC=protractor.ExpectedConditions;
var resubmit=element.all(by.buttonText('resubmit')).get('0');
browser.wait(EC.elementToBeClickable(resubmit), 15000,'Not Clickable'));
resubmit.click();

WebDriverError: unknown error: Element is not clickable at point (330, 367) even after using EC.elementToBeClickable

I am writing test cases in protractor using chromedriver
I have a link which when clicked gives an overlay div pop up where I can enter few details and Add details. After adding the details again the main page and link is visible. But when I am trying to click on the main link second time I am getting
WebDriverError: unknown error: Element is not clickable at point (330, 367). Other element would receive the click:
I tried using the below code still issue is not resolved
browser.wait(EC.elementToBeClickable(link)).then(function(){
link.click().then(function(){
browser.sleep(3000).should.notify(next);
});
});
Can someone please help
I have seen this in my application before, Once you close the pop-up you have to wait for the window closing animation to finish. Your flow should be something like below
browser.wait(EC.elementToBeClickable(link),5000)
//Fill the pop-up
element(by.css('.textArea')).sendKeys('jhghaskjdhkjasd')
//close the pop-up
element(by.css('.close')).click()
//wait for the pop-up to close
browser.wait(ExpectedConditions.invisibilityOf(element(by.css('.pop-up'))),5000)
Also as a side point, you don't need to chain all webdriverJs promises.They are already placed in queue using Protractor control flow

Accounts.ui.config: Can't set `passwordSignupFields` more than once

In one of my react components, I have this
<a href={'/application/' + username +'/' +appid}>My Application</a>
When I click on that link, I get the javascript error Accounts.ui.config: Can't set 'passwordSignupFields' more than once.
However, when I go to the directly to the url http://192.168.0.110:3000/application/john/X93ajdsfj by pasting the url into the browser address bar, then the page loads without errors. I only get an error when I load the page by click on the anchor tag.
I suspect that when I click on the link, I'm probably not doing a full HTTP page reload, and only parts are reloaded, and this javascript found in my myproject.jsx gets fired again:
// This code is executed on the client only
Accounts.ui.config({
passwordSignupFields: "USERNAME_ONLY"
});
I am completely new to meteor. What is the best way to avoid this problem?
I moved the code out of the React component and into the main .jsx file of the meteor project and wrapped it with a Meteor.isClient if statement like so:
if(Meteor.isClient)
{
// This code is executed on the client only
Accounts.ui.config({
passwordSignupFields: "USERNAME_ONLY"
});
}

"Send" button popup not appearing correctly

I'm using the Facebook Like/Send buttons along with dynamically generated HTML (loaded via AJAX requests). I've found that even though the Send button works fine when the element exists on page load, dynamically created Send buttons aren't working correctly. Clicking the button activates it and the button greys out, but the popup doesn't appear.
Here is a demonstration of what is happening: http://jsfiddle.net/Daniel15/VxpSj/
Any suggestions?
Thanks!
Yes, I can confirm the problem from your fiddle.
function addLikeButton()
{
// […]
FB.XFBML.parse(newEl);
document.getElementById('container').appendChild(newEl);
}
For some reason, this seems to be “the wrong way around”. Reverse the order of these two lines – put the new element into the DOM first and let FB.XFBML.parse parse it afterwards, then (from my test with your fiddle) it seems to work in the desired way.

Unable to locate WindowID

I am currently testing a web app using selenium rc with eclipse. I've been having issues with a single pop up window which appears when a submit button is clicked. The confirmation window appears with a single 'ok' option.
I've also tried 'chooseOKonnextConfirmation' in conjunction with .getConfirmation but eclipse tells me no confirmation exists. I've tried inspecting the window itself with firebug but have been unable to get any results.
I also tried with "selenium.selectWindow(getAllWindowIDs ()[1]);" but selenium not recognizing "getAllWindowIDs".
Could somebody please tell me how I can retrieve the windowID and the associated API commands I need to implement to get rid of this problem?
from your description, i understand that you have an ALERT window being appeared after clicking SUBMIT button but not the CONFIRMATION window.
if my understanding is correct
( you said single OK button - ALERT window appears with single OK button - CONFIRMATION window appears with OK and CANCEL buttons - there is another window javascript can generate which is CONFIRMATION.it appears with TEXT field and OK and CANCEL buttons )
so you must use accordingly.
here is what you should use
if(selenium.isAlertPresent()) {
String message = selenium.getAlert();
}
this will consume you Alert window and you can check the message displayed on Alert window if you want.
if this is not please post write your comment
It's selenium.getAllWindowIds(); note the capitalisation. Don't forget to make sure the popup has already appeared (e.g. selenium.waitForPopUp()).
Yes sudarsan is correct if you have an alert.
If you have an popup window not an alert with OK button then you have to click OK when popup appears.
If you are unable to locate the button use firebug to locate the element.