selenium - Login Programmatically to DotNetNuke -
i'm working on windows console application base on c#. in app user enter username , password (assume gmail.com) should let them access other part of program if logged in successfully, if not won't permission.
search around these topics:
- post , get
- webrequest
- selenium
first checked msdn sample code received page source code! check selenium , should worked fine somehow. here code:
using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using openqa.selenium; using openqa.selenium.firefox; using openqa.selenium.support.ui; namespace gmail_login { class program { static void main(string[] args) { iwebdriver driver = new firefoxdriver(); driver.navigate().gotourl("http://gmail.com/"); //find target fields iwebelement user = driver.findelement(by.name("email")); iwebelement pass = driver.findelement(by.name("passwd")); iwebelement submit = driver.findelement(by.name("signin")); //[end] user.sendkeys("urusernamexd"); pass.sendkeys("urpass^_^"); // submit login form submit = driver.findelement(by.name("signin")); submit.click(); //[end] //result string url = driver.url; //check stat if (url == "https://mail.google.com/mail/?shva=1") { console.writeline("login successfully"); driver.close(); } } } }
this worked fine open real browser. want check these information without opening browser, possible?!!!
solve checked web-kit , i'm totally confused.
question is:
how can send user login information server, submit form if needed , response (not page source code!) ?
thanks.
note: site i'm working on base on "dotnetnuke cms"
Comments
Post a Comment