Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatically testing UIWebView content with Selenium

I have an iPhone application that contains a UIWebView for rendering certain UI aspects. The UIWebView content communicates with the Objective-C side through NSURLRequests. I'd like to test the UIWebView contents with Selenium so it could be automated.

The problem is the communication with the native side, as this is not supported by Selenium. Therefore, a way is needed to "fake" the Objective-C side. The UIWebView sends requests to a specific (non-existant) URL that are then interpreted by the native code and processed. When running the UIWebView's contents with Selenium, these requests will always fail.

Is there a way to somehow provide support in Selenium that would allow catching these requests and providing a dummy response, or is there a better tool for this?

Preferably, I'd also like to run the Selenium tests with Sauce Labs, or a similar Selenium service, so hacking /etc/hosts is not an option either.

like image 364
TuomasR Avatar asked May 02 '26 06:05

TuomasR


1 Answers

Have you tried Appium? It should allow you to write WebDriver tests that invoke the UIAutomation library.

like image 155
Ross Rowe Avatar answered May 04 '26 22:05

Ross Rowe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!