-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: SetClipboardText Doesn't work correctly #916
Comments
Hi, What values did you passed to the method? |
The endpoint https://github.com/appium/WebDriverAgent/blob/d7cff1a389586f3f492cfd789175e21d838f21da/WebDriverAgentLib/Utilities/FBPasteboard.m#L29 conver the content type as lower case. I assume it might not be content type related |
UIA2 driver does not normalise the characters case |
I think attaching the appium server log also might help. e.g.
|
-Android What values did you passed to the method? deviceManager.Driver.SetClipboardText("hello", "label"); i got this error
appium server log
|
Could you share the entire appium server as well to see the dependent version etc as GIST? |
Hm, dotnet-client/test/integration/Android/ClipboardTest.cs Lines 45 to 58 in e8d5eaf
The only thing I could think of is.... host machine? I used macOS, not Win. Other logs in the attached GIST looks good. I modified my local uia2 driver version also but mine worked with Android SDK 29 emulator worked on my local as well. https://dev.azure.com/AppiumCI/dotnet-client/_build/results?buildId=30011&view=results running on Win env also passed. hm.. |
Could you run |
@KazuCocoa, the build you provided isn't running the SetClipboardText, but I can confirm it does work on Win ENV
Regardless, I suggest @unalman update his Dotnet client to the latest version (7.1.0) |
Another question for @unalman. What is the type of |
after this https://gist.github.com/unalman/0cb337586e636d16cda5ccb117c42823
public class DeviceManager : IDisposable
{
private AndroidDriver _driver;
public DeviceManager(string serial, string appiumHost, int implicitWaitSeconds, int commandTimeoutSeconds)
{
try
{
var serverUri = new Uri(appiumHost);
var driverOptions = new AppiumOptions()
{
AutomationName = AutomationName.AndroidUIAutomator2,
PlatformName = "Android",
DeviceName = "Android Device",
};
driverOptions.AddAdditionalAppiumOption("udid", serial);
driverOptions.AddAdditionalAppiumOption("noReset", true);
driverOptions.AddAdditionalAppiumOption("newCommandTimeout", 300);
driverOptions.AddAdditionalAppiumOption("unicodeKeyboard", true);
driverOptions.AddAdditionalAppiumOption("resetKeybord", true);
_driver = new AndroidDriver(serverUri, driverOptions, TimeSpan.FromSeconds(commandTimeoutSeconds));
_driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(implicitWaitSeconds);
}
catch (Exception ex)
{
Console.WriteLine($"DeviceManager initialization failed: {ex.Message}");
throw;
}
}
public AndroidDriver Driver => _driver;
public void Dispose()
{
if (_driver != null)
{
_driver.Quit();
_driver.Dispose();
_driver = null;
}
}
} I updated the latest version but it doesn't change anything. |
Thank you for the logs. I still couldn't reproduce this error with .net client and the same uia2 driver version against the endpoint, but actually your log still had the error... Can you share the device logcat? The adb logcat may have like below endpoint call:
|
@KazuCocoa Could it be related to the below?
|
Not really. They usually don't affect this set clipboard endpoint. I added these caps also to have the same capabilities, but no error occurred. |
As I said before, this method work perfectly but public static void SetClipboardTextCustom(this DeviceManager deviceManager, string textContent, string label)
{
// Clipboard'a metin ekle
deviceManager.Driver.ExecuteScript("mobile: setClipboard", new Dictionary<string, object>
{
{ "content", textContent },
{ "label", label },
{ "type", "PLAINTEXT" }
});
} |
Yes, so I was wondering why only your environment had an issue with
|
I don't mind sending dotnet-client/test/integration/Android/ClipboardTest.cs Lines 53 to 58 in e8d5eaf
|
I couldn't understand either. |
Would #920 help? It sends |
Thanks for your help. Do I have to wait for your next release to test it? |
I don't know well about .net client's deps management, but if your project could refer to the GitHub branch, you can test that out. It is appreciated to do it if possible since this occurs only your environment for now 🙏 |
@unalman, would you prefer I send you the |
sure. can u invite mi to slack channel mail: [email protected] |
@Dor-bl sent me nuget package. But i got new error. but i understand why i got this. In Turkish, the capital letter "i" is "İ" i guess thats why toUpper() work differently.
appium log
full appium log https://gist.github.com/unalman/2b9dbdba1619b5f2a7644ebda03c080a You can test like that var text = "i";
Console.WriteLine(text.ToUpper(new CultureInfo("en-US", false))); // result: I
Console.WriteLine(text.ToUpper(new CultureInfo("tr-TR", false))); // result: İ |
It was helpful. So, we should use |
I made an update in #920 |
Yes, this seems like it could solve our problem. @Dor-bl could you send me new version again? |
@unalman Sent on Slack |
Unfortunately I got again
Appium logs https://gist.github.com/unalman/045c407eeda00fc7745c9468d1b6983e |
@KazuCocoa, Maybe we should just consider moving this method to the mobile extension. |
Maybe |
No ToUpper call with the latest #920 with my latest comment #916 (comment). The only place is below, which will be fixed in #921
It's also good after the PR merge, which fixes the current main. Both formats in terms of contentType are the same. |
So what's the call here @KazuCocoa ? |
I'm good with #920 |
I tried SetClipboardText() method but i got this error.
OpenQA.Selenium.WebDriverArgumentException: 'Only '[PLAINTEXT]' content types are supported. 'plaintext' is given instead'
Then i created custom method for setclipboard. And it work.
i guess the problem here is ToLower()
https://github.com/appium/dotnet-client/blob/main/src/Appium.Net/Appium/AppiumCommandExecutionHelper.cs#L25
The text was updated successfully, but these errors were encountered: