Appium Webview for windows application not working,
once i click on webview/Hybrid app icon on top of appium inspector , not able to fetch all the webview HTML DOM elements.
I tried adding capabilities for windows
{
"platformName": "windows",
"appium:platformVersion": "10",
"appium:deviceName": "WindowsPC",
"appium:app": "xxxxx",
"appium:allowInvisibleElements": true,
"appium:autoWebview": true,
}
can you help me out with any other capabilities thats need to be added or any other work around how to get the DOM element once i click on appium inspector from windows app.
You can see webview HTML DOM elements for IOS. But not in windows
Windows - https://i.stack.imgur.com/y503o.png
IOS - https://i.stack.imgur.com/nd3oD.png
Related
Need a alternative to Appium Inspector to view xpath of ios app elements, appium inspector is not getting refreshed ,so that i need to restart the inspector every time to work ,and when connecting its very slow , kindly suggest me alternative .
In my application i want to change default webview browser
XAML
<WebView x:Name="webView" Grid.Row="1" Navigated="webView_Navigated">
</WebView>
C#
WebView web = new WebView()
{
Source = res.url,
};
webView.Source = web.Source;
When i am trying using like this facing issue with google authentication
error :
this browser or app may not be secure.
How can I resolve this issue ?
The message "this browser or app may not be secure." is not caused by the web view. You need to check the URL and the configuration.
Addressing the original question WebView is not very configurable. Xamarin Essentials have "Browser" but it is even less.
If you want to have more control over the web renderer you need to approach the problem with custom renderer using WebKit (for Android) and UIWebView (for iOS) controls.
I have tried my UWP app on XBOX one which is built using xamarin.forms and it works generally fine but by default mouse mode is active. I changed it using
RequiresPointerMode = Windows.UI.Xaml.ApplicationRequiresPointerMode.WhenRequested;
on UWP level in app.xaml.cs and it disabled mouse pointer but problem is that using game pad, i am not able to select items on the UI. I can navigate through textbox and buttons but not Toolbar (Commandbar in uwp), ListView, Masterdetail, Tabs etc.
I created a blank native UWP application and added a commandbar with AppBarButtons and NavigationView with NavigationViewItems. It perfectly works, I am able to navigate between menu items and commanbaritems using mouse pad.
Why this is not working for Xamarin.Forms? is xamarin.forms not actually native for UWP?
Xamarin.Forms MasterDetailPage was written before NavigationView existed and it doesn't use it at all (and especially not with NavigationViewItems, that would limit the flexibility, i don't think it will ever be used).
As SplitView has some focus bug that I can confirm it doesn't come as a surprise that it doesn't work with XBox as expected. However UWP doesn't grant that the app will work properly when you disable the mouse mode with native controls, that's why it is enabled by default. There are properties like XYFocusLeft that must be set if the app is not working properly. You probably need to make custom renderer to expose those properties and set them right. That's pretty much of work to do but it is up to you to decide...
I made a simple browser with Swift last version and xcode 8.3.3.
I want to be able to enter in fullscreen when there is an html5 video (like on youtube).
I get "full screen is unavailable" on youtube right now.
Same problem with the old WebView... on iOS it work.
EDIT. Maybe it's just not possible. I tried to look at JavaFX WebView and WPF WebBrowser and they have the same limitation. Actually one guy was able to allow full screen for a youtube video on WPF WebBrowser but only by creating a full html page:
Playing youtube in full screen in WebBrowser control
And of course I cannot create a webpage for every video in a page (at least I don't know how, if you know please tell me).
ORIGINAL MESSAGE:
I made a simple browser with Swift last version and xcode 8.3.3.
Everything is working but I'm not able to activate plugins like I can do with the old WebView.
Since I'm on a mac I should be able to activate plugins (I understand that it's not possible on iOS) am I wrong?
Also (and here I got the same problem in the old WebView) there is no way to activate fullscreen for html5 videos (at least I don't know how).
#IBOutlet weak var webView: WKWebView!
let urlString = "http://myurl.com/"
self.webView.load(NSURLRequest(url: NSURL(string: urlString)! as URL) as URLRequest!)
self.webView.configuration.preferences.plugInsEnabled = true
This is the really basic code to get a basic browser working. But there is no option to enable plugin in the Interface Builder for WKWebView and I really don't know how to allow fullscreen for html5 videos (like youtube).
EDIT. Ok I finally found an answer for the plugin part:
self.webView.configuration.preferences.plugInsEnabled = true
really easy but it was difficult to understand where to find it I had to go here:
https://developer.apple.com/documentation/webkit/webpreferences
and take a guess...
Update for macOS 12.3
Starting on iOS 15.4 and macOS 12.3 WKPreferences has the new property isElementFullscreenEnabled. Now it is very simple:
myWebView.configuration.preferences.isElementFullscreenEnabled = true
Original answer (pre macOS 12.3)
Instead of using private APIs you can do this by changing the property with KVO in the configuration.
Using Swift 5:
let configuration = WKWebViewConfiguration()
configuration.preferences.setValue(true, forKey: "fullScreenEnabled")
let webView = WKWebView(frame: .zero, configuration: configuration)
Tested on macOS 10.15 and 11
To allow WKWebView to use fullscreen HTML you need to access private API's (see https://github.com/WebKit/webkit/blob/master/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm#L232-L240) in WKPreferences. Since you're using Swift in your bridging header add:
#import <WebKit/WebKit.h>
#interface WKPreferences ()
-(void)_setFullScreenEnabled:(BOOL)fullScreenEnabled;
#end
And simply call it:
let webView = WKWebView(frame: view.frame)
webView.configuration.preferences._setFullScreenEnabled(true)
If you notice strange resizing of the web view once you exit fullscreen I found that this fixes the issue for me:
webView.autoresizingMask = [.width, .height]
view.addSubview(webView)
webView.translatesAutoresizingMaskIntoConstraints = false
webView.topAnchor.constraint(equalTo: view.topAnchor).isActive = true
webView.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true
webView.rightAnchor.constraint(equalTo: view.rightAnchor).isActive = true
webView.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true
Note: Since you're accessing private API this would be rejected on the Mac App Store.
The solution posted by #SoneeJohn was clear, but it involved using a bridging header. I'd never manually worked with Objective-C or modified private Swift frameworks before. I didn't know what keywords to use. And, the resources I found seemed more involved and focused on creating an original framework - not altering an existing framework. I don't know if this is the proper implementation, but it got full-screen mode to work in web view.
Steps
There are photos that reference each of the following steps in the next section.
Click your "Project" in XCode
Click "Add a target"
Click "Cocoa Framework"
Click "Next"
Enter a title into "Product Name"
Click "Finish"
Click "Add items" in "Linked Frameworks and Libraries"
Enter "WebKit" into the "Search"
Click "WebKit.framework"
Click "Add"
Click your "Project.h" file
Add the "Import" code from the solution
#import <WebKit/WebKit.h>
Add the "Full Screen" code from the solution
#interface WKPreferences ()
-(void)_setFullScreenEnabled:(BOOL)fullScreenEnabled;
#end
Import your "Project Framework" into your swift file
Implement the "Full Screen" code into your web view
webView.configuration.preferences._setFullScreenEnabled(true)
I had to change my user agent to Safari 11 for the full-screen mode to work properly.
webView.customUserAgent = """
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13) AppleWebKit/604.1.31 (KHTML, like Gecko) Version/11.0 Safari/604.1.31
"""
The answer is that there is no answer. No API right now on mac to get fullscreen html5. I tried to make the same app on windows and the current WebView of UWP is able to go fullscreen (the old WebBrowser of WPF is not able to go fullscreen).
I think the only way to get it, it's to submit a feedback to apple.
I am new to Window Phone, and I am developing a in-app webview application. The website which i used for Window Phone is using javascript+jquery+ajax jsp.
some of the link in that webpage using Window Phone webbrowser cannot get the click event, so the page cannot negative to another page inside webbrowser component.
But while i am using the Browser on Window Phone (IE) , seems it work fine on negativing.
Can anyone help me on this issue?
Is that i need to enable some function in in-app webbrowser component?
Thanks.
Make sure that the IsScriptEnabled property is set to true:
WebBrowser.IsScriptEnabled Property
Enables or disables scripting.
This applies to the next document that is navigated to, not the
current document. This property is false by default. Set this property
to true to enable scripting, or false to disable scripting.