java - I cant fix the error that i am facing in my code, i downloaded all the needed Jar files i guess -


this question has answer here:

i facing error in below line:

dr = new androiddriver(new url("http://127.0.0.1:4723/wd/hub"),capabilities); 

--> unhandled exception type malformedurlexception

the code is:

import java.net.malformedurlexception; import java.net.url;  import org.openqa.selenium.by; import org.openqa.selenium.remote.desiredcapabilities; import org.testng.annotations.test;  import io.appium.java_client.android.androiddriver;  public class dailertest {      androiddriver dr;      @test     public void call() {          desiredcapabilities capabilities = new desiredcapabilities();         capabilities.setcapability("devicename", "g6");         capabilities.setcapability("platformversion", "7.0");         capabilities.setcapability("platformname", "android");         capabilities.setcapability("apppackage", "com.android.contacts");         capabilities.setcapability("appactivity", "activities.dialtactsactivity");          dr = new androiddriver(new url("http://127.0.0.1:4723/wd/hub"),capabilities);      }  } 

the documentation says url class throw such exception if string null, unknown protocol specified or no protocol found.

try this;

dr = new androiddriver(new url("http", "127.0.0.1", 4723, "wd/hub"),capabilities); 

i not sure if works, url class offers constructor more suitable link. url class

edit

the error might because haven't handled possibillity there might exception thrown. can either declare when exception throw wrapping in try-catch statement, or can add throws declaration method signature.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -