how to select the login tab in naukri.com site

396 views
Skip to first unread message

Selenium_light

unread,
May 11, 2014, 12:50:23 PM5/11/14
to seleniu...@googlegroups.com
Hi,

I am trying to automate the first few pages of naukri.com site for my learning purpose.
But on running my script, I am not seeing the control going to the login tab and the username & password getting typed.. though I am able to navigate to next page ..
It seems, the tab has some java script code.which is running behind (due to RC's java script injection at front end)

could any one please guide me here..

NANI.THRINATH

unread,
May 12, 2014, 3:38:05 AM5/12/14
to seleniu...@googlegroups.com
  Seems it's working perfect! See following code!


          driver = new FirefoxDriver();
 driver.get("http://naukri.com");
 driver.findElement(By.linkText("Login")).click();
 driver.findElement(By.cssSelector("input[name='USERNAME']")).sendKeys("Email ID");
 driver.findElement(By.cssSelector("input[name^='PASS']")).sendKeys("PASSWORD");
 driver.findElement(By.cssSelector("button[type='submit']")).click();

Regards,
Thrinath


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/a062fe27-61c1-430c-846b-e1aeaf62565c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Regards,
Thirnath

shwetank singh

unread,
May 12, 2014, 7:20:21 AM5/12/14
to seleniu...@googlegroups.com
You can try with below code, make sure you had uploaded the log4j jar.


import java.util.concurrent.TimeUnit;
import org.apache.log4j.Logger;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

public class UploadResume   {
public static WebDriver driver = new FirefoxDriver();
public static Logger logs = Logger.getLogger("devpinoyLogger");
@BeforeClass
public static void init() {
driver.get("http://www.naukri.com/");
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(20L, TimeUnit.SECONDS);
System.out.println("1");
}
public void Logs(String msg){
logs.debug(msg);
}
// to login into "http://www.naukri.com/"
@Test
public void doLogin(){
driver.findElement(By.xpath("//*[@id='tab2']/a")).click();
logs.debug("login_tab selected");
driver.findElement(By.xpath("//*[@id='username']")).sendKeys("usernameABC");
logs.debug("UseID entered");
driver.findElement(By.xpath("//*[@id='password']")).sendKeys("passwordABC");
logs.debug("Password Entered");
driver.findElement(By.xpath("//*[@id='loginBtn']")).click();
logs.debug("Submit button Entered");
Reply all
Reply to author
Forward
0 new messages