How to input value into an international number text box in selenium

Below is the text box and the corresponding HTML:

If I used sendkeys, sometimes it may not working

driver.findElement(By.name(“mainphone”)).sendKeys(“(02)2222-2222”);
driver.findElement(By.id(“mobilephone”)).sendKeys(“05-5555-5555”);

If sendkeys() methods are not working then use following two ways to input text:

Before sendkeys() use click() method to click inside textfield i.e:

driver.findElement(By.name("mainphone")).click();
driver.findElement(By.name("mainphone")).sendKeys("(02)2222-2222");   
driver.findElement(By.id("mobilephone")).click();
driver.findElement(By.id("mobilephone")).sendKeys("05-5555-5555");