Not able to identify elements by id

I want to automation one login page (web-view) for an ios application, i can locate the ID of the username and password field but when i am using the driver.elementById() it shows no such element found. Does any one have any idea about this.
I am using mocha and chai.
can only access the element using className i.e driver.elementByClassName( ‘UIATextField’ ), but i guess which is not the correct way.

Try it by using :-
driver.findElement(By.id(“Element_ID here”).sendkeys(“DesiredValues here”);

Hope it helps you!

Hi Jitender,

As i am using javascript and mocha i don’t think above code will work in my case, though it works fine in java.

Do you have any other solution in javascript.

Thanks,
Pankaj

are you switching to web-context before locating elements in webview? can u please share your code snippet also share the steps which you performed?

Also can u check the logs of ios_webkit_debug_proxy?

Hey @Pankaj_Sharma,
I don’t have that much knowledge of java script. But when i was searching for the solution, i found these couple of links that might be helpful for you.
Here are the links :-

https://www.packtpub.com/books/content/testing-ui-using-webdriverjs

That’s all i could do for you.
Hope you find your solution in these webpages.

Thanks,
Jitender