I'm trying (for too long...) to get appium working with react native, but can't seem to find any element.
I'm using an emulator, Nexus 6, android 6.0, ubuntu, appium 1.6.0, RN 0.39.2.
I'm trying to get the most basic example to work:
// foo.js
render () {
return (
<Text>foo</Text>
)
}
// spec.js
// ... some setup ...
driver
.elementByAccessibilityId('foo')
.click()
and I'm getting...
1) should be able to find 'Buttons' and click it
0 passing (13s)
1 failing
1) Android find and click should be able to find 'Buttons' and click it:
Error: [elementByAccessibilityId("foo")] Error response status: 7, , NoSuchElement - An element could not be located on the page using the given search parameters. Selenium error: An element could not be located on the page using the given search parameters.
I also tried setting:
<Text accessible accessibilityLabel={ 'foo' }>foo</Text>
same response ...
any ideas?
I ended up using this solution:
<Text accessibilityLabel={ 'FOO' } testID={ 'FOO' }>some stuff here</Text>
and then in the test:
driver
.elementByAccessibilityId('FOO')
Credit goes to #jonesdar for pointing that out here
Related
I'm trying to load a image from users phone, crop it and then display. Im using the webview plugin to do that. It works as intended on android but not on IOS.
I've tried this from another question, which resloves to file not found error
itemSrc = itemSrc.replace(/^file:\/\//, '');
I also looked at NormalizeURL but that does not seem to work with Ionic 4
Heres some code
this.imagePicker.getPictures(options)
.then((results: string[]) => {
results.forEach(res => {
this.crop.crop(res, {quality: 50})
.then(
data =>{
//this is extracting the URL
this.user.photos.push(this.webview.convertFileSrc(data));
},
After that, the UI should display the cropped image, which it does on android, but not on IOS.
I used safari dev tools to inspect and this is the error:
[Error] Failed to load resource: unsupported URL (unsafe:ionic://localhost/_app_file_/Users/radmac/Library/Developer/CoreSimulator/Devices/8E6A6BFA-66FA-4DB3-B556-BCE9E2EFE33A/data/Containers/Data/Application/C39D8D99-0F67-4D33-9195-EE2B4D4E4707/tmp/cdv_photo_024.jpg, line 0)
So, I found the solution for this. Before that, You can read this blog post which is really helpful if you want to understand more about ionic native and images.
https://ionicframework.com/blog/storing-photos-with-the-cordova-camera-and-file-plugins/
the solution was to just wrap the webview converted src with dom sanitizer, like so,
const resolvedImg = this.webview.convertFileSrc(data);
this.user.photos.push(<string>this.sanitizer.bypassSecurityTrustUrl(resolvedImg));
Make sure to import the dom sanitizer.
import {DomSanitizer} from "#angular/platform-browser";
...
constructor(private sanitizer: DomSanitizer){
...
}
I'm testing Android application and need to scroll text. I have tried everything I found here and on a Internet but nothing is working.
Appium v1.4.1 (Server v1.7.2)
Python 3.x
Using selenium webdriver
I need scroll to the bottom of a page, not to specific element
The closest is
self.driver.execute_script("mobile: scroll", {"direction": "up"})
but it is not working
.
Log is:
selenium.common.exceptions.WebDriverException: Message: Unknown mobile command "scroll". Only shell commands are supported.
Thanks
For Android there are 2 good options when it takes to scrolling:
use TouchActions
actions = TouchActions(driver)
el = driver.find_element_by_id(<id of element you press to start swipe>)
action.press(el).move_to(x=100, y=-1000).release().perform()
You can also get screen size of the device to scroll more precisely:
screen_size = driver.get_window_size()
use native UiAutomator scrollIntoView method
self.driver.find_element_by_android_uiautomator('new UiScrollable(new UiSelector().resourceId("<id of scrollable view>")).scrollIntoView(new UiSelector().resourceId("<id of element to scroll to>"))')
You can read more here
I am using the Ionic Framework to build a mobile app for Android/iOS. I was able
to build the project for android (ionic build android). When I run the app, it will be only a white screen, that's because there is an error (when you use GapDebug, you can run apps on your phone and you will be able to debug, and see errors). Now if I run it on the desktop browser there really is NO error and everything is working. Below is the error that is shown in GapDebug:
Now when you check the code in service.js line 394:
There's nothing wrong with the code right? If I try to change line 394 to something like key : self.currentUser, there will be NO error and the app will work. What seems to be the problem here?
Not sure why you are making an object's attribute a list? If you want the key to be childQuestionSnapshot.key then remove the square brackets.
If you are trying to update a list of objects, you can do something similar to the below:
var test = [{key: 'thisguy'},{key: 'thatguy'},{key: 'myguy'}]
test.forEach(function(item){
item['key']='newguy'
})
console.log(test)
Do this instead
var updateObj = {};
updateObj[childQuestionSnapshot.key] = self.currentUser;
applicantRef.update(updateObj, function() {
console.log("applicant answers updated");
});
I am trying to test a hybrid app (created with ionic cordova) with calabash.
I am not able to see any elements in the console. Any query statement returns [] Below is the code snippet of what I did. Let me know what is wrong.
D:\ionicProject\todo\platforms\android\build\outputs\apk>calabash-androi
d console android-debug.apk ADB_DEVICE_ARG=emulator-5554
Starting calabash-android console...
Loading C:/Ruby21/lib/ruby/gems/2.1.0/gems/calabash-android-0.5.15/irbrc
Running irb...
*** WARNING: You must use ANSICON 1.31 or higher (https://github.com/adoxa/ansic
on/) to get coloured output on Windows
irb(main):001:0> start_test_server_in_background
nil
irb(main):002:0> query("webView css:'*'")
[]
irb(main):003:0> query("CordovaWebView css:'*'")
[]
First simply use query('*') and see all the result.
Then find all the element with class using
query('*', :class)
Then find all the element with class using
query('*',:id)
If you want to display only text content
query('*', :textContent)
if you know the correct view (ie webview or systemview) You can use that view name instead of *
Need to use SystemWebView instead of CordovaWebView
Example:
query("SystemWebView css:'*'")
Yesterday (10/19/2015 06:00 PM), the ARC Welder app begin to not start apps.
For some reason, now, when I click "TEST", nothing happens on Windows 10, I tested on MAC/Windows 7 also, and works fine.
Chrome
Versão 46.0.2490.71 (64-bit)
ARC Welder
46.5021.478.14
Update
This is the error shown on console.
Uncaught (in promise) TypeError: Cannot read property 'angle' of
undefined
at $jscomp.scope.Plugin.computeLayout_ (chrome-extension://joabdphlghkbahegchlcmhbaaijcgghj/_modules/mfaihdlpglflfgpfjcifdjdjcckigekc/gen_index.min.js:125:302)
at $jscomp.scope.Plugin.doLayout_ (chrome-extension://joabdphlghkbahegchlcmhbaaijcgghj/_modules/mfaihdlpglflfgpfjcifdjdjcckigekc/gen_index.min.js:122:383)
at $jscomp.scope.Plugin.initializeWindow_ (chrome-extension://joabdphlghkbahegchlcmhbaaijcgghj/_modules/mfaihdlpglflfgpfjcifdjdjcckigekc/gen_index.min.js:98:175)
at null. (chrome-extension://joabdphlghkbahegchlcmhbaaijcgghj/_modules/mfaihdlpglflfgpfjcifdjdjcckigekc/gen_index.min.js:95:238)
Workaround SOLUTION at bottom.
Ok so what I have so far is not a solution just information
The problem seems to be coming from the runtime part of the Arc Extension:
SEE-> https://chrome.google.com/webstore/detail/app-runtime-for-chrome-be/mfaihdlpglflfgpfjcifdjdjcckigekc
The problem is in the file plugin.js
// Let the CameraManager in Android know what the current orientation is
var message = {
namespace: 'pluginCameraManager',
command: 'screenRotation',
data: {
'angle': screen.orientation.angle
}
};
this.postMessage(message);
Cannot read property 'angle' of undefined at...
'angle': screen.orientation.angle
//for context
var a=Promise.all([this.createAppPlugin_(),window.arcparams.systemDirectoriesReady]);
//problem is initializeWindow_() fails
a.then(function(){this.initializeWindow_();
** WORK AROUND SOLUTION**
This may cause more bugs, I don't know, do it at own risk.
Open the file:
%LOCALAPPDATA%\Google\Chrome\User Data\Default\Extensions\mfaihdlpglflfgpfjcifdjdjcckigekc\46.5021.478.18_0\gen_index.min.js
ie
extension://joabdphlghkbahegchlcmhbaaijcgghj/_modules/mfaihdlpglflfgpfjcifdjdjcckigekc/gen_index.min.js:125:302)
So on line 125 at character 302 you should find the word 'angle' as in:
data:{angle:screen.orientation.angle}
change that to:
data:{angle:0}
0 is used,you can read about why -> Find screen angle when orientation is fixed in android