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:
- java malformed url exception 1 answer
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
Post a Comment