Selenium WebElement Login button findElement

chima
chima used Ask the Experts™
on
Hello,
I'm looking for the right findElement setting for the login button.  I had it working at one time with id="u_0_q", but then it stopped working.  I'm using Window 10 Edge Webdriver
What could work?  The first three lines are the DOM locator.  The first line looks to be a frame, before the login button.
The login button is that of www.facebook.com login
//<label class="uiButton uiButtonConfirm" id="loginbutton" for="u_0_q">
//<input tabindex="4" id="u_0_q" type="submit" value="Log In" data-testid="royal_login_button"
//></label>
				//driver.findElement(By.xpath("html/b[b]/b]ody/div[1]/div[1]/div/div/div/div/div[2]/form/table/tbody/tr[2]/td[3]/label/input")).click();
		//driver.findElement(By.cssSelector("input[data-testid=royal_login_button]")).click();
		//driver.findElement(By.id("u_0_q")).click();
		//driver.findElement(By.cssSelector("input[value=royal_login_button")).click();//absolute not work
		//driver.findElement(By.id("loginbutton")).click();//works for Edge!
		//driver.findElement(By.id("loginbutton")).click();

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2015

Commented:
I would use find by ID since your DOM has an ID defined on that element.

Author

Commented:
gurpsbassi, thank you for your response.  I tired firefox and all of the ones that I tried in MS Edge, work with firefox;
//All of these work with firefox, but not with Edge
               //driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div/div/div[2]/form/table/tbody/tr[2]/td[3]/label/input")).click();
		//driver.findElement(By.cssSelector("input.inputtext[id=u_0_q]"));// can't get click
		//driver.findElement(By.cssSelector("input[data-testid=royal_login_button]")).click();  
		//driver.findElement(By.cssSelector("input[type=submit]")).click();
		//driver.findElement(By.cssSelector("input[id=u_0_q]")).click();
		//driver.findElement(By.id("u_0_q")).click();
		//driver.findElement(By.cssSelector("input[value=royal_login_button")).click();
		//driver.findElement(By.id("loginbutton")).click();//works for Edge!
		//driver.findElement(By.id("loginbutton")).click();
		driver.findElement(By.cssSelector("input[value=Log In]")).click();

Open in new window


I'm editing this comment, after noticing that one of the statements did not have a click method.  I then noticed that facebook opens up even without any commend
to open/click on the login button.  
Why is this happening?
Top Expert 2015

Commented:
I really don't understand the question.
HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

Author

Commented:
gurpsbassi,  the question is now two fold; ! - these findElement statements do not work with MS Edge browser.  I would like to know what works.
I made a second comment that the same findElement statements listed work with the firefox browser.
In stating this fact to you, I noticed that one statement was completely wrong.  I checked to see why and learned that facebook login was allowing me to enter my account without having to click on login.
So now the second question is; why is it that this is happening (login without the .click() method?)
Top Expert 2015
Commented:
you might want to raise an issue in any microsoft edge web driver forums. Can't imagine why such a basic thing would not work!
But then again, its microsoft :)

I've not seen that behaviour with Facebook. before. I've just tried it, I always get the login page and have to manually click the log in button all the time.

Author

Commented:
Expert Commentby:gurpsbassi  Let me play with it a bit more.  If I can "make my case," then I'll report it.  First of all; I need to find out why firefox logs in without clicking on the "login" button.  In Eclipse I cleaned my project and rebuilt the project, yet I got the same result.
I'm working on another program/project, so I'll be right back.

Author

Commented:
Expert Commentby:gurpsbassi, I came back to it, and this time none worked.  Then I did a clean and rebuild of the project and now they all work.  Question is; is it truly working?  Have you ever seen this?  Might "it" be affecting other project code?
Top Expert 2015

Commented:
Never seen it sorry.

Author

Commented:
Thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial