Quality Testing

Quality is delighting customers

hi All

can any help me that how can i enter mobile number into a text field if that text field is having mobile mask with the help of webdirver

For Reference plz have a look at this link  and click on 'phone text field which is last text field of this form 

http://www.musiczeal.com/musician-registration.aspx

Thanks in Adv

Views: 368

Attachments:

Reply to This

Replies to This Discussion

Try with below logic .


driver.findElement(By.id("ctl00_mainbody_txtPhone1")).click();

driver.findElement(By.id("ctl00_mainbody_txtPhone1")).sendKeys(Keys.HOME);

driver.findElement(By.id("ctl00_mainbody_txtPhone1")).sendKeys(1234567890);

SantoshSarma,

could you please give me the code for Selecting a value from dropdown box from the same website.

THanks and regards

/// this section is for selecting value from dropdown

new Select(driver.findElement(By.id("ctl00_mainbody_ddlCountry"))).selectByVisibleText("United Kingdom");
Thread.sleep(2000);
new Select(driver.findElement(By.id("ctl00_mainbody_ddlState"))).selectByVisibleText("East Midlands");

/// this section is for entering telephone/ mobile number


driver.findElement(By.id("ctl00_mainbody_txtPhone1")).click();
driver.findElement(By.id("ctl00_mainbody_txtPhone1")).sendKeys("0987656443");

this code will work

driver.findElement(By.id("ctl00_mainbody_txtPhone1")).click();
driver.findElement(By.id("ctl00_mainbody_txtPhone1")).sendKeys("0987656443");

Thank u very Much @Santosh ,Akash bros .Valueble solutions it works fine .

After trying Akash cmd number was entered but when submit btn clicked mobile number started disappearing.I fedup by trying more than 10 time .i thinked lot why it was happening like that and tried manully by entering mobile number statring with "0" then know that mobile numbers starting with "0" this application automatically rejects.

Thank U 

 

Hi Roopesh,
Before enter pass the value to mobile number field better to use clear method to pass new value.i had faced same issue in http://www.way2sms.com site for entering the date of birth field value,after using clear method it was working fine.
driver.findElement(By.id("ctl00_mainbody_txtPhone1")).clear();
Thanks,
Subbu

RSS

TTWT Magazine


Advertisement

Advertisement

Advertisement

Advertisement

© 2019   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service