0

I am using Selenium-Java (version: 4.3.0)

My web application has a simple dropdown with some values in it.

I am using below command to select the value in the dropdown

        driver.findElement(By.id("phoneCountryCode")).sendKeys("USA");

I am running my test on Windows Chrome browser, Samsung Galaxy S10 (mobile device) with Samsung browser. The dropdown selection works perfectly fine

However, the same command driver.findElement(By.id("phoneCountryCode")).sendKeys("USA"); does not wotk with iPhone 11 (mobile device) with OS version 15.

It does not throw any error at line driver.findElement(By.id("phoneCountryCode")).sendKeys("USA"); It does nothing when this line is executed and USA does not get selected in the dropdown. The command driver.findElement(By.id("phoneCountryCode")) works fine. But, the command sendKeys("USA"); does not do anything.

The reason I am using sendKeys function and not using Select class because, on IOS mobile devices Select class is not recognised.

Can someone please help me in this regard why sendkeys is not working on IOS mobile device? Or if there is any alternative way to select the value from the dropdown apart from using Select class in selenium?

Sweety
  • 117
  • 6
  • 18

1 Answers1

0

If you want to select a dropdown value then right click on the value that you want to select go to HTML code and select any attribute you want like CSS attribute, id selector,className selector then

driver.findElement(By.className("Class Name")).click();

or

driver.findElement(By.id("Id Name")).click();

or

driver.findElement(By.xpath("//input[@atribureName='value']")).click();
Junaid Khalid
  • 811
  • 2
  • 11
  • 26