MobileElement library cannot be found in java-client-8.2.1-all.jar - selenium

How can I add MobileElement libary? I am using java-client-8.2.1-all.jar and I have imported io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileCapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
I also added the dependency in app > build.gradle
implementation files('libs/java-client-8.2.1-all.jar')
Any idea?
Thanks

Related

Unresolved reference for Launch in CoroutineScope(IO).Launch

I've read the following, it doesn't answer my question.
Unresolved reference: launch
I'm trying to follow the following tutorial https://www.youtube.com/watch?v=z7lfPYLGE7k for creating a simple socket in Kotlin. Everything is trivial up to this point:
I have:
CoroutineScope(IO).Launch {
client(address, port)
}
However, this gives the error:
Unresolved reference: Launch
It is unclear to me what I should put in my dependencies in build.gradle, I've tried a slew:
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:x.x.x"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:x.x.x"
implementation("androidx.collection:collection-ktx:1.2.0")
implementation("androidx.fragment:fragment-ktx:1.5.4")
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.5.1"
implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.5.1")
implementation("androidx.navigation:navigation-runtime-ktx:2.5.3")
implementation("androidx.navigation:navigation-fragment-ktx:2.5.3")
implementation("androidx.navigation:navigation-ui-ktx:2.5.3")
implementation("androidx.palette:palette-ktx:1.0.0")
implementation("androidx.lifecycle:lifecycle-reactivestreams-ktx:2.5.1")
implementation("androidx.room:room-ktx:2.4.3")
implementation("androidx.sqlite:sqlite-ktx:2.2.0")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1")
implementation("androidx.work:work-runtime-ktx:2.7.1")
implementation("com.google.android.play:core-ktx:1.8.1")
I also don't understand what I should import, again I've tried probably more than necessary:
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.system.Os.socket
import java.net.Socket
import java.util.*
import android.widget.TextView
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.coroutines.*
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.CoroutineName
import kotlinx.coroutines.async
import kotlinx.coroutines.launch
import androidx.activity.viewModels
Failing this, I've also tried the following to see if I can call the client() function from these:
viewModelScope.launch {
}
viewLifecycleOwner.lifecycleScope.launch {
}
lifecycleScope.launch {
}
However, they have the same problem.
The method you're looking for is:
CoroutineScope(Dispatchers.IO).launch {
...
}
Without the capitalization in the method name.

error:can't import name 'Protocal' from 'typing'

when i run import ptwtin colab,an error discribed in title occurs,but as I run
from typing_extensions import Protocol,it runs correctly.So how to import ptwt in colab?

Wrong source added (JSONTokener) Intellij

Class JSONTokener is giving an error on the constructor JSONTokener(InputStream in). When I do Alt+Enter and select import class it imports from hive. I have hive and org.json and many others in my pom. I want it to select the correct version. This. I have written it in the pom but I don't understand why it doesn't import from this.
<!-- https://mvnrepository.com/artifact/org.json/json -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20160810</version>
</dependency>
If I view the source it doesn't has the required constructor it only as two with String and Reader but not InputStream.
EDIT:
These are the imports
import com.jayway.jsonpath.JsonPath;
import org.apache.commons.io.IOUtils;
import org.apache.nifi.annotation.behavior.SideEffectFree;
import org.apache.nifi.annotation.documentation.CapabilityDescription;
import org.apache.nifi.annotation.documentation.Tags;
import org.apache.nifi.components.PropertyDescriptor;
import org.apache.nifi.flowfile.FlowFile;
import org.apache.nifi.logging.ComponentLog;
import org.apache.nifi.processor.ProcessContext;
import org.apache.nifi.processor.ProcessSession;
import org.apache.nifi.processor.ProcessorInitializationContext;
import org.apache.nifi.processor.Relationship;
import org.apache.nifi.processor.exception.ProcessException;
import org.apache.nifi.processor.io.InputStreamCallback;
import org.apache.nifi.processor.io.OutputStreamCallback;
import org.apache.nifi.processor.util.StandardValidators;
import org.everit.json.schema.Schema;
import org.everit.json.schema.ValidationException;
import org.everit.json.schema.loader.SchemaLoader;
import org.json.JSONObject;
import org.json.JSONTokener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
And this is the line where it gives compilation error:
JSONObject jsonSchema = new JSONObject(new JSONTokener(getClass().getResourceAsStream("/identification/carrier.json")));
Cannot resolve constructor JSONTokener(java.io.InputStream)

Failed to instantiate class in selenium-cucumber framework

I am using cucumber 3.0.2.My testrunner code is given below.
package futurerx_testrunner_pkg;
import org.junit.runner.RunWith;
import cucumber.api.junit.Cucumber;
import cucumber.api.CucumberOptions;
#RunWith(Cucumber.class)
#CucumberOptions(features="features/login.feature",glue= {"stepdefinition"})
public class testrunner {
}
I have created 2 packages in src(futurerx_testrunner_pkg and stepdefinition).I have testrunner.java in futurerx_testrunner_pkg package and Basedefinition.java in stepdefinition package.
But when i am running the code,it gives an error "Failed to instantiate class stepdefinition.Basedefinition at cucumber.runtime.java.DefaultJavaObjectFactory.cacheNewInstance(DefaultJavaObjectFactory.java:47) at cucumber.runtime.java.DefaultJavaObjectFactory.getInstance(DefaultJavaObjectFactory.java:33) at cucumber.runtime.java.JavaStepDefinition.execute(JavaStepDefinition.java:48)".
I am new to this cucumber-selenium framework and not understanding where i am going wrong.Thanks in Advance.

Jar files required to access Selenium class functions

Currently I have included the following JAR files to playback selenium recordings using JAVA.
junit-4.10.jar
selenium-java-2.24.1.jar
selenium-server-standalone-2.24.1.jar
Also I have imported these packages
import com.thoughtworks.selenium.Selenium;
import java.util.NoSuchElementException;
import java.util.concurrent.TimeUnit;
import org.junit.After;
import static org.junit.Assert.fail;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.NoAlertPresentException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import org.openqa.selenium.support.ui.Select;
But with just these, I am not able to access selenium class functions like getAlert() or getConfirmation().
So are there any library files or JAR files that I have missed out on?
You can download the Java Client driver package 2.25.0 from the Selenium HQ site and then add all the jars in your project's referenced libraries.
You didn't imported the DefaultSelenium class which is in com.thoughtworks.selenium package so add this line to your code and it will work.
import com.thoughtworks.selenium.DefaultSelenium;