i have written simple script, which launches an chrome app on Android N(7.0),but not able to run, getting error
Details Environment
Appium version (or git revision) that exhibits the issue: 1.4.16.1
Last Appium version that did not exhibit the issue (if applicable): N/A
Desktop OS/version used to run Appium: window 7/32 bit
Node.js version (unless using Appium.app|exe): node-v8.9.4-x86
Mobile platform/version under test: chrome browser /64.0.3282.123
Real device or emulator/simulator:Android 7.0.0:MotoG(4)/Build/NPJS25.93-14-10
Appium CLI or Appium.app|exe: Appium Desktop exe
Error logs
info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Command failed: C:\Windows\system32\cmd.exe /s /c "D:\android-sdk\platform-tools\adb.exe -s ZY2239HZB2 install "C:\Program Files (x86)\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk""\nadb: failed to install C:\Program Files (x86)\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk: Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.unlock without first uninstalling.]\r\n)","killed":false,"code":1,"signal":null,"cmd":"C:\Windows\system32\cmd.exe /s /c "D:\android-sdk\platform-tools\adb.exe -s ZY2239HZB2 install "C:\Program Files (x86)\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk""","origValue":"Command failed: C:\Windows\system32\cmd.exe /s /c "D:\android-sdk\platform-tools\adb.exe -s ZY2239HZB2 install "C:\Program Files (x86)\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk""\nadb: failed to install C:\Program Files (x86)\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk: Failure [INSTALL_FAILED_ALREADY_EXISTS: Attempt to re-install io.appium.unlock without first uninstalling.]\r\n"},"sessionId":null}
code:
import java.net.MalformedURLException;
import java.net.URL;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileCapabilityType;
import org.openqa.selenium.By;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.BrowserType;
import org.openqa.selenium.remote.DesiredCapabilities;
//import org.testng.annotations.Test;
public class StartChrome
{
public static void main(String[] args) throws MalformedURLException{
DesiredCapabilities cd=DesiredCapabilities.android();
cd.setCapability(MobileCapabilityType.BROWSER_NAME,BrowserType.CHROME);
cd.setCapability(MobileCapabilityType.PLATFORM,Platform.ANDROID);
// we need to define platform name
cd.setCapability(MobileCapabilityType.PLATFORM_NAME,"Android");
// Set the device name as well (you can give any name)
cd.setCapability(MobileCapabilityType.DEVICE_NAME,"my phone");
// set the android version as well
cd.setCapability(MobileCapabilityType.VERSION,"7.0");
// Create object of URL class and specify the appium server address
URL url= new URL("http://127.0.0.1:4723/wd/hub");
// Create object of AndroidDriver class and pass the url and capability that we created
WebDriver driver = new AndroidDriver(url, cd);
// Open url
driver.get("http://www.facebook.com");
// print the title
System.out.println("Title "+driver.getTitle());
// enter username
driver.findElement(By.name("email")).sendKeys("sni****#gmail.com");
// enter password
driver.findElement(By.name("pass")).sendKeys("*****8");
// click on submit button
driver.findElement(By.id("u_0_5")).click();
// close the browser
driver.quit();
Please update your Appium version as it's very old and you're seeing a known issue with Android 7.0 that was resolved in 1.6.0 (released October 2016).
If that's not possible, run the following commands before running your script:
adb -s device_serial uninstall io.appium.settings
adb -s device_serial uninstall io.appium.unlock
Related
I am trying to launch chrome on my Android mobile which has chrome version: 76.0.3809.89
When I run my Java program, I get below error:
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details. Original error: An unknown server-side error occurred while processing the command. Original error: Unable to automate Chrome version because it is too old for this version of Chromedriver.
Chrome version on the device: Chrome/76.0.3809.89
Visit 'https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/web/chromedriver.md' to troubleshoot the problem.
Failed to start Chromedriver session: A new session could not be created. Details: session not created: Chrome version must be between 71 and 75
**(Driver info: chromedriver=2.46.628402** (536cd7adbad73a3783fdc2cab92ab2ba7ec361e1),platform=Windows NT 10.0.17763 x86_64)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'abc', ip: '10.0.1.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_221'
Driver info: driver.version: AndroidDriver
remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Unable to automate Chrome version because it is too old for this version of Chromedriver.
**Chrome version on the device: Chrome/76.0.3809.89**
Visit 'https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/web/chromedriver.md' to troubleshoot the problem.
I have below questions:
From where it is picking chromedriver=2.46.628402 as it mentions in the log ?
How to fix this error?
My code:
package browserTest;
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
import io.appium.java_client.android.AndroidDriver;
import io.github.bonigarcia.wdm.WebDriverManager;
public class ChromeTest {
public static void main(String args[]) {
//Set the Desired Capabilities
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability("deviceName", "My Android Mobile");
cap.setCapability("udid", "521010f9ee4fb499");
cap.setCapability("platformName", "Android");
cap.setCapability("platformVersion", "7.0");
cap.setCapability("browserName", "Chrome");
cap.setCapability("noReset", true);
//Instantiate Appium Driver
AppiumDriver<MobileElement> driver = null;
try {
driver = new AndroidDriver<MobileElement>(new URL("http://127.0.0.1:4723/wd/hub"), cap);
}catch (MalformedURLException e) {
e.getMessage();
}
//Open URL in Chrome browser
driver.get("http://www.google.com");
}
}
i'm using Windows and AppiumServer with nodejs
you can download at https://chromedriver.storage.googleapis.com/index.html
matching chrome driver version
and change chrome driver at
C:\Users\{username}\AppData\Roaming\npm\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win
with this command chromedriver.exe -version
you can check version like this
C:\Users\{username}\AppData\Roaming\npm\node_modules\appium\node_modules\appiu
m-chromedriver\chromedriver\win>chromedriver.exe -version
ChromeDriver 2.46.628402 (536cd7adbad73a3783fdc2cab92ab2ba7ec361e1)
C:\Users\{username}\AppData\Roaming\npm\node_modules\appium\node_modules\appiu
m-chromedriver\chromedriver\win>chromedriver.exe -version
ChromeDriver 76.0.3809.12 (220b19a666554bdcac56dff9ffd44c300842c933-refs/branch-
heads/3809#{#83})
You need the correct chromedriver which can handle Chrome 76 on your device.
You can try to set in manually with appium see here:
npm install appium --chromedriver_version="76.0.3809.68"
Another option that should work would be to use the WebDriverManager.
It automatically downloads the correct driver and sets the capabilities accordingly.
Just add it to your project.
For example if you have a gradle project add following line to your build.gradle:
compile group: 'io.github.bonigarcia', name: 'webdrivermanager',
version: '3.6.2'
Then you need to set the chromedriver in your driver capabilities:
WebDriverManager.chromedriver().setup();
cap.setCapability("chromedriverExecutable", WebDriverManager.chromedriver().getBinaryPath());
I try to run in VSCode a simple dart program with
import 'dart:html';
clause.
import 'dart:html';
// import 'package:html/dom.dart';
// import 'package:html/dom_parsing.dart';
// import 'package:html/parser.dart';
void main() async{
var myTable = new TableElement()
..setAttribute('border','1');
// ..setAttribute(name, value);
...
In Run mode (I use VSCode extension "Code Runner 0.9.9") and in Debug appeared the same error:
Error: Not found: 'dart:html'
import 'dart:html';
I have installed Dart SDK 2.3.1 at Windows10 and not installed Flutter at all.
PATH pointed to Dart SDK bin directory
PATH =D:\Dart\dart-sdk\bin;
*) At project directory I try to add additional directive at pubspec.yaml
dependencies:
----
name: main
description: Test App sample22
dependencies:
html:
---
After "pub get" command I'll see that html present but error still persist.
pub get
Resolving dependencies...
+ charcode 1.1.2
+ csslib 0.16.0
+ html 0.14.0+2
+ path 1.6.2
+ source_span 1.5.5
+ term_glyph 1.1.0
Changed 6 dependencies!
*) My next step was to import html parts via "package:html/" (marked as comments in code sample). It is not helped and required class TableElement still unrecognizable.
"main.dart:8:19: Error: Method not found: 'TableElement'."
*) I try to change "launch.json" string from
default
"program": "bin/main.dart",
to
"program": "D:/Dart/WRK03t/main.dart",
And rename my code file to "main.dart"
*) Also I try to remove Dart extension from VSCode, restart PC and install it again. it's not helped.
But let me say that when I compile main.dart to js
"dart2js -m -o tst.js main.dart"
Resulted tst.js run correctly within the html page.
Almost the same problem in Request Dart Installation doesnt find dart:html
dart:html is only available in the browser. This is the error you get if you try to run code that uses it on the VM (instead of the browser). This is expected.
If you need to run your code outside of the browser (eg. in the VM as a CLI app or via Fluter) you cannot use dart:html. If you only want to use it in the browser but VS Code is trying to run your code in the VM, you'll need to set up some VS Code tasks/launch configs to run build_runner, similar to the Dart DevTools project:
https://github.com/flutter/devtools/tree/abe811f66e1bd36612b76bbe28250bc669a6ce08/.vscode
Unable to build Selenium Script in Jenkins.
Generating error related to Browser driver.
Working Code in Eclipse with Maven
package test;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeTest;
import java.net.MalformedURLException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.AfterTest;
public class NewTest {
private WebDriver driver;
#Test
public void testEasy() throws InterruptedException {
System.out.println("Testing");
driver.get("http://www.google.com/");
Thread.sleep(5000);
String title = driver.getTitle();
}
#SuppressWarnings("deprecation")
#BeforeTest
public void beforeTest() throws MalformedURLException {
System.out.println("#BeforeTest");
//System.setProperty("webdriver.gecko.driver", "F:\\Selenium\\Selenium Library\\drivers\\geckodriver.exe");
//Now you can Initialize marionette driver to launch firefox
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability("marionette", true);
/*FirefoxOptions options = new FirefoxOptions()
.addPreference("browser.startup.page", 1)
.addPreference("browser.startup.homepage", "http://demo.guru99.com/test/guru99home/");
driver = new FirefoxDriver(options);
*/
driver = new FirefoxDriver();
}
#AfterTest
public void afterTest() {
System.out.println("##AfterTest");
driver.quit();
}
}
After trying to run POM.xml build in Jenkins. It's result failed because of Unable to execute gecko driver.
enter image description here
Failed
test.NewTest.beforeTest (from TestSuite)
Failing for the past 26 builds (Since Unstable#11 )
Took 1.2 sec.
add description
Error Message
The path to the driver executable must be set by the webdriver.gecko.driver system property; for more information, see https://github.com/mozilla/geckodriver. The latest version can be downloaded from https://github.com/mozilla/geckodriver/releases
Stacktrace
java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.gecko.driver system property; for more information, see https://github.com/mozilla/geckodriver. The latest version can be downloaded from https://github.com/mozilla/geckodriver/releases
at test.NewTest.beforeTest(NewTest.java:39)
Standard Output
#BeforeTest
Standard Error
Apr 20, 2018 2:12:36 PM org.openqa.selenium.remote.DesiredCapabilities firefox
INFO: Using `new FirefoxOptions()` is preferred to `DesiredCapabilities.firefox()`
Any one have idea about how to resolved this issue please provide me solution for that
Genymotion with VirtualBox download from genymotion site and install properly
Add Genymotion pluging on eclipse and set Genymotion directory
Add virtual device Nexus9 os version 5.1.0 API 22
Add Selenium and Appium java client jar files under project
Use Genymotion Android Tool and Custom Android SDK tool as Genymotion ADB tool connection setting
Configure Appium Setting and run Appium
Run below source code on eclipse
import java.io.IOException;
import org.apache.commons.exec.CommandLine;
import org.apache.commons.exec.DefaultExecuteResultHandler;
import org.apache.commons.exec.DefaultExecutor;
import org.apache.commons.exec.ExecuteException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import java.net.URL;
import io.appium.java_client.android.AndroidDriver;
public class Firstappium {
static String deviceName = "Nexus9-5.1.0API22";
static WebDriver driver;
static String url ="http://127.0.0.1:4720/wd/hub";
public static void main(String[] args) {
DefaultExecuteResultHandler resultHandler;
DesiredCapabilities capabilities = new DesiredCapabilities();
DefaultExecutor executor = new DefaultExecutor();
resultHandler = new DefaultExecuteResultHandler();
capabilities.setCapability("deviceName","Nexus9-5.1.0API22");
capabilities.setCapability("platformVersion", "5.1");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("app","G:/appium/apk/cz.hipercalc.apk");
driver = new AndroidDriver(new URL(url),capabilities);
System.out.println("Appium Driver is launched successfully");
}
}
Every time Appium can't find to the Genymotion emulator within session time. Please check attached screen shot
I have a problem when trying to run my application on the device or create IPA file.
I followed the steps here and I have this error when trying to run on iOS option:
[ERROR] Failed when running /usr/bin/codesign: FdawaDev: no identity found
I tried to make it throw terminal with this command
forge package ios --ios.profile.provisioning_profile Development.mobileprovision
and I'm getting this error
/Applications/TriggerToolkit.app/Contents/MacOS/forge -v package ios --ios.profile.provisioning_profile Development.mobileprovision
[ INFO] Forge tools running at version 3.3.43
[ DEBUG] Checking for update zip...
[ ERROR] Couldn't import generation code: No module named generate_dynamic
[ DEBUG] Traceback (most recent call last):
File "/Applications/TriggerToolkit.app/Contents/MacOS/build-tools/forge/async.py", line 98, in run
result = self._target(*self._args, **self._kwargs)
File "/Applications/TriggerToolkit.app/Contents/MacOS/build-tools/forge/main.py", line 443, in package
generate_dynamic = forge_build.import_generate_dynamic()
File "/Applications/TriggerToolkit.app/Contents/MacOS/build-tools/forge/build.py", line 67, in import_generate_dynamic
raise ForgeError("Couldn't import generation code: {0}".format(e))
ForgeError: Couldn't import generation code: No module named generate_dynamic
I removed TriggerToolkit and download the latest one, installed it again and I'm still getting the same error.
What am I missing?
The first error is a configuration problem: you're pointing at an iOS developer identity called "FdawaDev" when one doesn't exist in your Keychain.
Unless you have several identities, you can safely leave the "Certificate" Local Config setting empty in the Toolkit.
If you have several identities, you should specify one with something like iPhone Developer: James Brady.
For the second problem, when using the command line tools, you have to manually run a build before doing a run or package action, e.g.:
% forge build ios && forge package ios