Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8831169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:15:05+00:00 2026-06-14T08:15:05+00:00

There are two fields in the page: Username and Password(Highlighted in the below code

  • 0

There are two fields in the page: Username and Password(Highlighted in the below code with **). Need to enter data into it using selenium. However, both the objects have same identifier elements except tabIndex. Please help me as to How to identify the elements(Please refer html).

Please note: The below code worked for me but user will not be able to see the data that is input in the GUI. I want the data to be seen on the UI.

Thanks,
Mike

@FindBy(name="cams_cb_username")
private WebElement emailId;

@FindBy(name="cams_cb_password")
private WebElement password;   
((JavascriptExecutor)DriverFactory.getDriver()).executeScript("arguments[0].setAttribute('value',arguments[1]);", emailId, "username");
((JavascriptExecutor)DriverFactory.getDriver()).executeScript("arguments[0].setAttribute('value',arguments[1]);", password, "pwd");

Here is the HTML.

<form action="/vito-mma/activateLogin.do" method="post" name="loginForm">
<input type="hidden" value="vitocom" name="cams_security_domain">
<input type="hidden" value="/vito-mma/showPlans.do" name="cams_original_url">
<input type="hidden" value="http" name="cams_login_config">
<input type="hidden" value="" name="cams_cb_partner">
<fieldset class="mma-signin">
<div class="clearfix">

<**input class="bigtext e-hint" type="text" value="" name="e_hint_dummy_input" size="25" autocomplete="off" tabindex="1" style="display: inline;"**>

<input class="bigtext e-hint" type="text" title="Email address" value="" tabindex="1" size="25" name="cams_cb_username" style="display: none; background-color: rgb(255, 255, 255);" autocomplete="off">
</div>
<div class="clearfix">

<**input class="bigtext e-hint" type="text" value="" name="e_hint_dummy_input" size="25" autocomplete="off" tabindex="2"**>

<input class="bigtext e-hint" type="password" title="Password" value="" tabindex="2" size="25" name="cams_cb_password" style="display: none; background-color: rgb(255, 255, 255);" autocomplete="off">
</div>
</fieldset>
<div class="indent">
</form>

Note:
Tried with Xpath: Did not work.
Recorded with IDE for username, (name=”cams_cb_username”). Used this – Did not work either.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T08:15:06+00:00Added an answer on June 14, 2026 at 8:15 am

    You could customize the xpath to use the tabindex attribute and the name attribute :

    @FindBy(xpath="\\input[@name='cams_cb_username' and @tabindex='1']")
    private WebElement emailId;
    
    @FindBy(xpath="\\input[@name='cams_cb_password' and @tabindex='2']")
    private WebElement password;
    

    Or alternatively, you could use something like this :

    WebElement username = wait.until(presenceOfElementLocated(By.xpath("\\input[@name='cams_cb_username' and @tabindex='1']")));
    WebElement password = driver.findElement(By.xpath("\\input[@name='cams_cb_password' and @tabindex='2']"));
    username.clear();
    username.sendKeys(username);
    password.clear();
    password.sendKeys(password);
    password.submit();
    

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

On our login page, we have two input fields (username and password), but the
in this page: http://www.legrandclub.net there are two text fields. In all web browser all
This is the url of my page : http://www.animalswecare.com/Ads/postad.php There are two fields category
I have a JSF page with two forms (pseudo-code below). First form is for
when our event edit page is loaded, there are two date fields where the
Why in Boolean type there are two fields with the same value? internal const
In a leave application form, there are two time fields 'From' and 'To'. When
is there a way l can compare two columns | fields in django like
In my models.py, I user these code to extent two fields: User.add_to_class('bio', models.TextField(blank=True)) User.add_to_class('about',
I has a jsp page (index.jsp) with a form with two text fileds username

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.