Reputation: 1545
I am just coding the my desired capabilities in eclipse using sauce labs. I want to open a web page in safari.
(I should add I am an utter newbie to cloud automated testing.)
When I get to the section of connecting the desired capabilities to sauce labs I am horribly stuck.
I got an error message in eclipse that said 'URL cannot be resolved to a type'
additionally I am not utterly confident in the IOS driver syntax as it gave an error message
References to generic type IOSDriver<T> should be parameterized
Here are my questions:
'URL cannot be resolved to a type'
IOSDriver driver = new IOSDriver(new URL("http://USERNAME:[email protected]:80/wd/hub"), cap); driver.get("https://www.bbc.co.uk/");
So I don't get
References to generic type IOSDriver should be parameterized
so I can successfully run these desired capabilities with the correct information.
I would appreciate you assistance and considerable knowledge.
Here is my code
package iOSCloudTesting;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.ios.IOSElement;
public class IosCloudSauce {
public static final String USERNAME = "confidential";
public static final String ACCESS_KEY = "confidential";
public static final String URL = "https://" + USERNAME + ":" + ACCESS_KEY + "@ondemand.saucelabs.com:443/wd/hub";
public static void main(String[] args){
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability("platformName", "iOS");
cap.setCapability("deviceName", "iPhone8 Simulator");
cap.setCapability("platformVersion", "11.3");
cap.setCapability("browserName", "Safari");
cap.setCapability("deviceOrientation", "portrait");
IOSDriver driver = new IOSDriver(new URL("http://USERNAME:[email protected]:80/wd/hub"), cap);
driver.get("https://www.bbc.co.uk/");
Upvotes: 0
Views: 1067
Reputation: 11474
Making my comment above a full answer:
'URL cannot be resolved to a type'
Add the following import to the top of your file:
import java.net.URL;
Your IDE should also be able to do that for your automatically. In Eclipse e.g. mark the URL occurrence in your code and use the “Quick Fix” functionality.
References to generic type IOSDriver should be parameterized
This is a warning about a missing type parameter (your code will compile and run, despite the warning). To really fix it, add the type parameter to your constructor invocation. In your case you can probably simply write:
IOSDriver<?> driver = new IOSDriver<>(…); // or alternatively:
IOSDriver<IOSElement> = new IOSDriver<>(…);
Upvotes: 0
Reputation: 139
Use following line to get proper URL
WebDriver driver= new RemoteWebDriver(new URL("http://USERNAME:[email protected]:80/wd/hub"),cap);
Upvotes: -1