I am new to Crosswalk. So far I have embedded it using Android Studio and can load a webpage via XWalkView.load(url,null)
However I also need to pass POST data via the HTTP Headers.
With the native Android WebView I'd pass data in the second parameter as WebView.loadUrl(url,additionalHttpHeaders)
How can I achieve the same in my Crosswalk implementation?
Finally I achieved this, I think it's a new feature on the latest versions, I used CrossWalk WebView 19.49.514.0.
There's a new method wich accepts a third parameter, like the classic WebView.
Example:
XWalkView xwView=(XWalkView)findViewById(R.id.xwView);
Map<String, String> extraHeaders = new HashMap<String, String>();
extraHeaders.put("Referer","http://www.myref.com/");
xwView.load("http://headerscheck.byethost24.com/headers.php",null,extraHeaders);
Related
I'm using Flutter web_socket_channel package to communicate with server. The class WebSocketChannel doesn't take a header parameter.
factory WebSocketChannel.connect(Uri uri, {Iterable<String>? protocols}) =>
platform.connect(uri, protocols: protocols);
When using IOWebSocketChannel to pass header, I'm getting Unsupported operation: Platform._version in web like given here. It is working fine in Android and iOS.
The concise answer is: No because only the path in your URI and protocol field can be set up.
Longer answer:
In the pure JS WebSocket API, there is no method to specify extra headers for the browser to send.
You can specify only
GET query(was://mysockets.com/path)
and header protocol called Sec-WebSocket-Protocol
Conclusion: If you can't achieve such functionality in the native code then this functionality is unavailable for your flutter web app
Happy coding
On some browsers there exists the the property serial on the window.navigator object.
I can see it on chrome but not on safari.
How can I access that object via dart in flutter web?
dart:html doesn't seem to include it. Is there a way to manually extend the window.navigator object to include it?
In the end I didn't access the window.navigator object from dart.
I access the serial and do all of the checks in javascript.
I use Js context to get data back from the Javascript.
There is a button on a web page that makes an API call to third party application. And in return third-party application gets rendered on a web page.
Now, the third-party application (https://goknow.me/#/) is developed in flutter and I know nothing about flutter. I'm using java, selenium and webdriver for end to end testing. I'm using same set of tools for the rest of the application and it's working fine.
While inspecting in chrome, the DOM look like this:
Flutter application has a form and I want to find an element so that I can send inputs during testing automation. By searching online I found this appium-flutter-driver. I've also included the required jar in my project. With selenium webdriver I'm not able to find an element in flutter application that renders in Chrome browser on desktop.
Here's the code:
import pro.truongsinh.appium_flutter.FlutterFinder;
import pro.truongsinh.appium_flutter.finder.FlutterElement;
protected FlutterFinder find;
WebElement iframe = driver.findElement(By.xpath("//iframe[#id='know-iframe']"));
driver.switchTo().frame(iframe);
find = new FlutterFinder(driver);
FlutterElement elm = find.text("Email");
elm.click();
elm.sendKeys("hello world");
During testing automation I want to select fields in form and send inputs to those fields.
How to find an element in flutter web application that renders in another web application in Chrome browser on desktop?
Flutter Web is very different from normal web frameworks such as React or Vue. Looking at the official doc, it renders either into HTML elements (but still not the usual elements you see everyday), or directly draw onto a Canvas.
In addition, since it is a third-party app, it is mostly likely that you are not able to change their code. Thus, your appium-flutter-driver mostly will not work, because it says:
Under the hood, Appium Flutter Driver use the Dart VM Service Protocol with extension ext.flutter.driver, similar to Flutter Driver, to control the Flutter app-under-test (AUT).
You know, Dart VM service is only available when you run the Flutter app by source code in debug mode, or at least when you have control to the source code.
Therefore, my suggestion is: Can you treat the Flutter application as a "picture" instead of a DOM tree, and try to locate the buttons?
you can try using io.github.sukgu that helps you to work on the shadow elements. I was able to automate the scenario that you mentioned. Below is the detailed code.
Step 1 add the below dependency
<!-- https://mvnrepository.com/artifact/io.github.sukgu/automation -->
<dependency>
<groupId>io.github.sukgu</groupId>
<artifactId>automation</artifactId>
<version>0.1.3</version>
</dependency>
Step 2 use the below import in the test file
import io.github.sukgu.*;
Step 3 Below is the entire code that worked for me
WebDriver driver = new ChromeDriver();
driver.get("https://goknow.me/#/");
WebDriverWait wait = new WebDriverWait(driver,20);
wait.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.id("know-iframe")));
Shadow shadow = new Shadow(driver);
WebElement emailField = shadow.findElement("input[id='email']");
emailField.sendKeys("hello world");
Flutter team recommends using Flutter for "app-centric experiences" as "Progressive Web Apps, Single Page Apps, Existing Flutter mobile apps", but Flutter web app can also be embedded in a iframe tag.
They say:
At this time, Flutter is not suitable for static websites with text-rich flow-based content. For example, blog articles benefit from the document-centric model that the web is built around, rather than the app-centric services that a UI framework like Flutter can deliver.
You can read more about how a Flutter web app is deployed here.
When a Flutter app is built for the web, the page is rendered in 2 ways:
HTML renderer (on mobile browsers)
CanvasKit renderer (on desktop browsers)
I hope now you know a little more about Flutter framework. 🙂
I am trying to build an app using flutter and I would like to know how to retrieve the proxy settings of the device through flutter.
It's probably safe to assume that the HttpClient doesn't pick this up automatically, but you might want to test that.
So, now you need to interact with native code using plugins. There is already a rich library of plugins providing everything from battery level to video player. I can't see proxy in there anywhere, so you need to write your own plugin (which is just one of the standard flutter project types: app, package (just Dart code allowed) and plugin). A plugin is a bit like a package (other projects can depend on it) but includes native code too. It also includes a mini-app so that you can test your plugin code while developing it.
Your plugin will end up being similar to the existing Connectivity plugin, so you may want to copy from there. In your Android method implementation you will replace
NetworkInfo info = manager.getActiveNetworkInfo();
with
ProxyInfo defaultProxy = manager.getDefaultProxy();
You have return two values, the host name and the port, so put these in a Map
Map<String, String> map = new HashMap<String, String>();
map.put("host", defaultProxy.getHost());
map.put("port", Integer.toString(defaultProxy.getPort()));
result.success(map);
Bonus points if you submit your changes to the Connectivity plugin.
Can any body know how to implement the dynamic form builder base on API response in Android ?
I don't know how to build it in android activity and what's required api response.
I refer the bellow link for implement it in android
Dynamic Form Builder with CodeIgniter
database schema for a dynamic formbuilder
but can't understand exactly what was required
So, please help me if there any one know dynamic form builder.
After a long terms, I got a some good library JASONETTE-Android and Avocarrot/json2view which basically work on JSON object to implement the dynamically form of Android means you can convert your JSON object to Android View.