appium / appium/java-client

Switch between IOSDriver and RemoteWebDriver possible?

Open
#726 9 comments 0 reactions 1 assignee View on GitHub

@TikhomirovSergey is already working on this.

Since Sep 19, 2017.

bug question
Dominant language
Java
Stars
1.3k
Forks
752
Avg merge
6d 21h
Merged PRs (30d)
8

Description

Description

The problem

Hello again!

When I want to input data into element with IOSDriver:
IOSDriver iosd = new IOSDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
iosd.get("https://google.com");
iosd.findElement(By.id("lst-ib")).sendKeys("SOME DATA HERE"); // this is input for search box inside blank google site
-I got exception: NullPointerException

But when I start driver as RemoteWebDriver:
RemoteWebDriver rwd = new RemoteWebDriver (new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
rwd.get("https://google.com");
rwd.findElement(By.id("lst-ib")).sendKeys("SOME DATA HERE");

everything looks good, box is filled with: SOME DATA HERE.
I really want to use IOSDriver to switch context from WebView to Native because further I need to use TouchAction. Need to tap on some element.
So there is a question:
Can I switch between IOSDriver and RemoteWebDriver?

What I've found out yet:

  1. Casting
    IOSDriver iosd = (IOSDriver) new RemoteWebDriver (new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
    is impossible because of exception:
    org.openqa.selenium.remote.RemoteWebDriver cannot be cast to io.appium.java_client.ios.IOSDriver
  2. Debuging:
    WebElement we = iosd.findElement(By.id("lst-ib")); gives me not null element but its parent is null
    but when doing the same for RemoteWebDriver
    WebElement we = rwd.findElement(By.id("lst-ib")); gives me not null element with parent with many informations inside.
  3. Page source for both drivers are the same (when checked other site there where only change with tokens data but only with that. The html tree had the same 'levels'

Environment

-Appium version (or git revision) that exhibits the issue: v1.7.0-beta
-Last Appium version that did not exhibit the issue (if applicable): --------
-Desktop OS/version used to run Appium: OS X 10.12.6 Sierra
-Node.js version (unless using Appium.app|exe): v6.11.1
-Mobile platform/version under test: iOS 10.3
-Real device or emulator/simulator: Simulator
-Appium CLI or Appium.app|exe: Appium CLI

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.