appium / appium-for-mac

[deprecated] Application for automating a mac app with JSON wire protocol
Apache License 2.0
193 stars 70 forks source link

sendKeys(Keys.TAB) or Keys.ENTER etc doesn't work in Appium for MAC #6

Open navinjoy opened 10 years ago

navinjoy commented 10 years ago

Hi Dan,

I have the below simple code for TextEdit in OSX and its currently doesn't work the way it suppose to for Keyboard events Keys.TAB, Keys.ENTER.

I am not quite sure where's the issue is? whether its with sendKeys() method or the Keyboard events. Can you please have a look at the same.

import java.net.MalformedURLException; import java.net.URL;

import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.Platform; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.RemoteWebDriver;

public class TextEdit {

public static void main(String[] args) throws MalformedURLException, InterruptedException {

    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setPlatform(Platform.MAC);
    WebDriver appdriver = new RemoteWebDriver(new URL("http://localhost:8080/wd/hub"), capabilities);
    appdriver.get("TextEdit");

    WebElement textArea = appdriver.findElement(By.xpath("//AXTextArea[@AXRole='AXTextArea']"));
    textArea.sendKeys("Hello World");
    Thread.sleep(2000);
    textArea.sendKeys(Keys.TAB);
    Thread.sleep(2000);
    textArea.sendKeys("*******");
    appdriver.quit();

}

}

sangeethasriniv commented 10 years ago

Does your app have any hidden text field under the text area?

navinjoy commented 10 years ago

Thank you for the response.

There are no hidden text fields and they are Dojo controls.

Regards Navin

Sent from my iPhone

On Mar 4, 2014, at 9:26 AM, Sangeetha notifications@github.com wrote:

Does your app have any hidden text field under the text area?

Reply to this email directly or view it on GitHubhttps://github.com/appium/appium-for-mac/issues/6#issuecomment-36650241 .

fangmobile commented 10 years ago

Hi Navin, First of all please try to use this url when creating your remotedriver http://127.0.0.1:4622/wd/hub That being said, I think the special key code is not handled properly on the server side. A fix might be needed.

miksch123 commented 4 years ago

I wonder if it is possible to use seleniums action class to send enter or tab key...

Wizr commented 3 years ago

@navinjoy After reading the code and trying, I found this send_keys("\uE007") works for ENTER