How to switch from a Native to WebView?When i use the below code:
String context=ElementsAction.driver.getContext();
System.out.println(“Context Name” +context);
//Here my Context is getting printed as NativeAPP
Set<String> contextNames = ElementsAction.driver.getContextHandles();
for (String contextName : contextNames) {
System.out.println(contextName); //prints out something like NATIVE_APP \n WEBVIEW_1
}
In the above code snippet,line 2 the Context gets printed as NativeAPP but i am trying to get the WEBAPP view,but that line 4 fails and throws below error message.
“An unknown server-side error occurred while processing the command. (Original error: connect ECONNREFUSED) (WARNING: The server did not provide any stacktrace information)”
You need to switch context to WEBVIEW_1 specifically. Then remember to switch back to NATIVE_APP before interacting with any native elements. Note the specific spellings of the contexts. Also, pay attention to hybrid views, I have seen the index the WEBVIEW can change from WEBVIEW_1 to WEBVIEW_3 etc.
An unknown server-side error occurred while processing the command. (Original error: connect ECONNREFUSED) (WARNING: The server did not provide any stacktrace information)"
This error must coming up may be coz u are using a real ios device.
You will require to connect to proxy using : ios_webkit_debug_proxy -c UDID:27753
This should solve your problem.
MACPC270917:~ 244325$ brew install ios-webkit-debug-proxy
-bash: brew: command not found
i even tried the below but its prompting for a password and when i give password,it throws error
MACPC270917:~ 244325$ ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/…
/usr/local/share/man/man1/brew.1
==> The following directories will be made group writable:
/usr/local/.
/usr/local/bin
/usr/local/lib
/usr/local/share
/usr/local/share/man
/usr/local/share/man/man1
==> The following directories will have their group set to admin:
/usr/local/bin
/usr/local/lib
/usr/local/share/man
/usr/local/share/man/man1
Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/. /usr/local/bin /usr/local/lib /usr/local/share /usr/local/share/man /usr/local/share/man/man1
Password:
Sorry, try again.
Password:
Sorry, try again.
Password:
Sorry, try again.
sudo: 3 incorrect password attempts
Failed during: /usr/bin/sudo /bin/chmod g+rwx /usr/local/. /usr/local/bin /usr/local/lib /usr/local/share /usr/local/share/man /usr/local/share/man/man1
MACPC270917:~ 244325$