An element could not be located on the page using the given search parameters (Appium 1.13.0) - appium-android

I am working on Automation for Android App. While running the script, Appium unable to find the elements. I tried using Id, Xpath. Please help me with this...
Android version: 5.1.1 & 9
Appium Version: 1.13.0
Maven Project
#Test
public void login() {
driver.findElement(By.xpath("//com.vehito.vehitoplus[contains(#resource-id,'phone')]")).sendKeys("9632642105");
driver.findElement(By.id("com.vehito.vehitoplus:id/sign_in_button")).click();
}
Actual Result:
Encountered internal error running command: NoSuchElementError: An element could not be located on the page using the given search parameters

This error said that UIAutomator couldn't able to find that Element.
I found 2 problem with your Xpath code:
1- Replace , with = after resource-id.
2- You use packageName (com.vehito.vehitoplus) instead of the class name.
You can find the exact class name of the element with UIAutomator Viewer:
(Android SDK Dir)\tools\bin\uiautomatorviewer.bat
I mean you may use this: (If the element's class name be: android.widget.EditText )
driver.findElement(By.xpath("//android.widget.EditText[contains(#resource-id='phone')]")).sendKeys("9632642105");
In my experience, I found that By. library (XPath or ID) is not working well with #contains. So it's better if you use exact attributes.
e.g.
driver.findElement(By.id("com.vehito.vehitoplus:id/sign_in_button")).sendKeys("9632642105");
I hope this helps. If not, please provide a screenshot from the page and also UIAutomator viewer screenshot of this input element.

org.openqa.selenium.NoSuchElementException: An element could not be located on the page using the given search parameters.
For documentation on this error, please visit: https://www.seleniumhq.org/exceptions/no_such_element.html
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities {app: C:\Selenium\workspace\Ninja..., appPackage: com.ninjafocus.app, appactivity: com.ninjafocus.app.base.vie..., databaseEnabled: false, desired: {app: C:\Selenium\workspace\Ninja..., appPackage: com.ninjafocus.app, appactivity: com.ninjafocus.app.base.vie..., deviceName: Nokia 6, newCommandTimeout: 60, platformName: android, platformVersion: 9, udid: PLEGAR1780410318}, deviceApiLevel: 28,
Default suite
driver.findElementById("\r\n" + "com.ninjafocus.app:id/signinButton").click();
driver.findElementById("\r\n" + "com.ninjafocus.app:id/parentEmailText").sendKeys("pooja.yadav#gmail.com");
driver.findElementById("\r\n" + "com.ninjafocus.app:id/parentPasswordText").sendKeys("1234");
driver.findElementById("\r\n" +"com.ninjafocus.app:id/startedButton").click();

Related

ReferenceError: driver is not defined in Protractor

I'm a beginner. Can any one guide me?
Tests.js
describe("Test the calculator",()=>{
it("Addition functionality",function test(){
driver.browser.get("https://juliemr.github.io/protractor-demo/");
browser.manage().window().maximize();
//browser.manage().timeouts().implicitlyWait(3000)
})
})
Config.js
const driver= require("protractor")
exports.config= {
browserName: 'chrome',
framework: "mocha",
directconnect: true,
specs: ['./tests.js'],
mochaOpts: {
timeout: 0
}
}
At run time it display a message as "driver is not defined"
Chrome version: 83.0.4103.61 (Official Build) (64-bit)
Visual Studio code: 1.45.1
I see what's going on...
first of all, don't call protractor a driver. Don't confuse others and most importantly yourself. Protractor is protractor, period.
second, when you do const driver= require("protractor") your driver variable is available in conf.js, but when you call it from the spec, it's not there, because it's a local variable, not global. As simple as that, this is why you get this error
Third, you don't need to define protractor because it is a global variable, and is available anywhere in your project anyways. The same with browser, element, $, $$ they all are available globally in your project.
Fourth, lets assume for whatever GOOD reason you still want to define something that will be globally available just do global.driver = require('protractor') as described here https://stackoverflow.com/a/31208642/9150146, and then you can call by typing the variable name driver

Protractor - log type 'performance' not found error

webdriver-manager 12.1.5
protractor Version 5.4.2
Chrome version 75.0.3770.100
browser.manage().logs().get('performance');
This used to work fine before upgrading my webdriver-manager and protractor version.
(node:27715) UnhandledPromiseRejectionWarning: WebDriverError: invalid argument: log type 'performance' not found
(Session info: chrome=75.0.3770.100)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info:, os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.4', java.version: '1.8.0_191'
Driver info: driver.version: unknown
at Object.checkLegacyResponse (node_modules/selenium-webdriver/lib/error.js:546:15)
If I comment the browser.manage().logs().get('performance'); and other performance related code, then the test runs fine.
webdriver-manager logs show:
Starting ChromeDriver 75.0.3770.90 on port 12268
I came across a potential solution on this github issue thead. Apparently recently chromedriver has started to more strictly adhere to W3C standards and this has affected how webdriver activates logs.
We can get around this issue by setting the w3c: false flag in chromeoptions like so.
capabilities: {
browserName: 'chrome',
loggingPrefs: {
browser: 'ALL',
driver: 'ALL',
performance: 'ALL',
},
'goog:chromeOptions': {
perfLoggingPrefs: {
enableNetwork: true,
},
w3c: false,
},
},
New version might not support performance log type. You can always use getAvailableLogTypes function to check supported log types. I tried following code
var supportedLogTypes = await browser.manage().logs().getAvailableLogTypes();
received ouptput :
It means you can only use either of two supported log types.
I tried out the same thing with chrome 75.* and protractor 5.4.2 version. Following are my findings.
loggingPrefs object is one of the recognized capabilities like chromeOptions. This object allow us to decide preferences on logging part. Refer link for more details about capabilities.
In protractor context we have to pass loggingPrefs object to capabilities to enable it.
Once we pass it then we can use browser.manage().logs().get('performance'); to get all performance logs.
If you want to change perfLoggingPrefs then it is part of chromeOptions object and it has to be updated there. If we want to use default then no need to mention.
chrome use more strictly rule for w3c, when I test chrome driver 96, set w3c to false, I can get network log, but find_element failed and return dict value which is not WebElement

IBM Content Navigator ICN Plugin returns an error when configured but works fine

I am using ICN 3.0.3 IF7. I have a custom plugin that writes the following error to the console when I initially configure it into ICN.
The plugin itself works fine once configured.
Uncaught TypeError: cls is not a constructor
at Object.eval (ecm/widget/layout/AdminPane.js:9845)
at dojo.js.jgz:22442
at runFactory (dojo.js.jgz:611)
at execModule (dojo.js.jgz:691)
at dojo.js.jgz:397
at guardCheckComplete (dojo.js.jgz:699)
at contextRequire (dojo.js.jgz:396)
at req (dojo.js.jgz:32)
at Object._displayPluginConfig (ecm/widget/layout/AdminPane.js:9844)
at Object._pluginRequestCompleted (ecm/widget/layout/AdminPane.js:9759)
In addition, once it is configured, I cannot get the details on it like I can for the included AFP Viewer plugin:
Name: AFP Viewer
Version: 2.0.3.5
Repository types: None
Actions: None
Open Actions: None
Viewers: AFP Viewer
Features: None
Layouts: None
It seems like something is wrong with the plugin structure that doesn't affect its ability to run. I am worried because I just don't like seeing errors. Has anyone seen this before?
Looking at the error it seems like the module you specified in the plugin.java#getConfigurationDijitClass is either failing to instantiate, or isn't specified at all.
If you have a configuration dijit class configured, then ensure it's actually a widget and that it's constructor and postCreate method (if provided) don't throw an error :).
If you don't have one configured, set it to null to prevent instantiation

How to integrate tesseract-ocr with tika?

I need to integrate the tesseract-ocr which converts scanned image as pdf to text.
There is tesseractOCRParser already available.
But there is no invoke method given.
When I am trying to build tika with tesseract-ocr referral path I am getting the following error
Results:
Failed tests:
testNoConfig(org.apache.tika.parser.ocr.TesseractOCRConfigTest):
Invalid default tesseractPath value expected:<[]> but was:
<[/home/serendio/tesseract-ocr/]>
Tests run: 569, Failures: 1, Errors: 0, Skipped: 7
Can anyone help me out ???
Or any other-way to resolve this problem??
I think this can help :
https://wiki.apache.org/tika/TikaOCR
I followed this guide and I was able to easily extract the content!
I simply installed Tesseract and then Tika.
Using Tika 1.9 I was easily able to :
- extract the content directly calling a local Tika server
- extract the content in a custom application ( you can use the tika-example project) with no effort .
No modification was needed. Everything working out of the box.

Adobe CQ6 - Runaway ContentFinder

Starting on 1/13, our Adobe CQ6.0 SP1 error logs started filling up with:
GET /bin/wcm/contentfinder/product/view.json/etc/commerce/products HTTP/1.1] org.apache.jackrabbit.oak.plugins.index.property.strategy.ContentMirrorStoreStrategy Traversed 1041307000 nodes using index jcr:lastModified with filter Filter(query=select [jcr:path], [jcr:score], * from [nt:base] as a where isdescendantnode(a, '/etc/commerce/products') order by [jcr:lastModified] desc /* xpath: /jcr:root/etc/commerce/products//* order by #jcr:lastModified descending /, path=/etc/commerce/products//)
The error logs are huge and AEM 6.0 ran out of disk space:
error.log.2015-01-13: 30295763555 bytes
error.log.2015-01-14: 52886323200 bytes
We are able to reproduce the problem by issuing the following HTTP request against AEM Author:
GET /bin/wcm/contentfinder/product/view.json/etc/commerce/products
This issue suddenly on 1/13/2015, 9:47 a.m., with a co-worker loading a site in AEM 6.0, and ContentFinder never loaded, so she removed cf#, and then was able to proceed with the authoring of the content itself.
We are interested in knowing if others have had similar issues with ContentFinder in AEM6.0.
AEM 6.0 has a bug in the Querybuilder related to Oak 1.0.5. We need Oak to be upgraded to v1.0.9. The following URI has more information:
http://helpx.adobe.com/experience-manager/kb/aem6-available-hotfixes.html
SP1 needs to be installed first and then the hot fixes need to be installed in the given order over SP1. The two sample index packages (damLucene.zip and productsIndex.zip) need to be installed as well. These add the following indices:
/oak:index/damLucene
/etc/commerce/products/ntbaseProductsLucene