Unable to setValue on a XCUIElementTypeTextField using appium and wdio - appium

Unable to setValue on a XCUIElementTypeTextField using appium and wdio
The element is identified correctly. Also when I do getValue on the element, it returns the placeholder text in the element.
But the setValue does not work.

Related

Can not Use Selenium Driver With Golang Agouti Package

I use agouti package in golang. I run selenium docker image, and create a new web driver with the following command:
capabilities := agouti.NewCapabilities().Browser("chrome").With("javascriptEnabled")
command := []string{"java", "-jar", "selenium-server.jar", "-port", "4444"}
driver = agouti.NewWebDriver("http://127.0.0.1:4444/wd/hub", command, agouti.Desired(capabilities))
I create a new page and try to set a value of an element in this page. I find element with xpath by using the following command:
var selection = page.FindByXPath(xpath)
Then try to send key with SendKeys() method of Agouti, but it does not set the value to the element. I tried to send an API call to the selenium by using the JSON Wire Protocol of the selenium. In this case, I need the id of the element to send the request. I try to obtain the id of the element with the following code:
elems, _ := selection.Elements()
id := elems[0].ID
But when I print the id, I saw that it is empty. So my request is not sent. The error I get is like following:
request unsuccessful: Unable to execute request for an existing session: POST /session/bba01dd19db3a063304a40b59b4cefb7/element//value
The main reason is of the error is that the id of the element is empty.
Btw, when I use chrome driver it works properly
args = append(args, "disable-blink-features=AutomationControlled")
chromeOpts := agouti.ChromeOptions("args", args)
options = append(options, chromeOpts)
driver = agouti.ChromeDriver(options...)
I dont understand why i can not use the selenium in agouti, and why the id of the element is empty. I hope that I explain my problem.
Thanks

Appium Desktop recorder is using Xpath instead of Id

I'm exploring my Native App with Appium DeskTop. For an inputfield Appium Desktop is showing in the 'Find By Selector Window' an Id and a XPath expression.
When I recorded a Sendkeys action to this inputfield Appium DeskTop shows in the Recorder Window that the XPath expression is used to locate the Element instead of the Id. This is not what I expected, I expected the Id being used to locate the element.
I tried to use the Id in my Testprogram to locate the element, this is giving, when Explicit waiting for Visbilty of the Element, see C# code below:
wait.Until(ExpectedConditions.ElementIsVisible(By.Id("companyname")));
IWebElement bedrijf = (IWebElement)driver.FindElementById("companyname");
bedrijf.Click();
bedrijf.SendKeys("IBM");
Then the following exception appears:
OpenQA.Selenium.NoSuchElementException
What kind of an Id is presenting Appium Desktop here?
You need to use resource-id. For native android apps, usually id attribute is used as resource-id.
IWebElement bedrijf = (IWebElement)driver.findElement(By.xpath("//android.widget.EditText[#resource-id='companyname']"))

Alternative ways to input text on field

I need to test this login form on iOS Emulator, but when I try to insert text on element '//input[#name="email"]' the text is putted however when I select the element '//input[#name="password"]' the text from the first element disappear, the same happens when I press the '//div[#id="react-component-login-header']//button/div/span[1]" element.
I think the problem is related how the Text is inputted in form, since that using Selenium2Library (for Desktop) don't have this problem.
Any other way how I can insert text on the field? I don't have any problem in using other Libraries or creating Keywords on Python to auxiliary the tests (already did on other tests).
I already tried with:
Input Text
Input Value
Input Password (I know, but i needed to try something else)
*** Settings ***
Library Dialogs
Library AppiumLibrary
*** Variables ***
${defaultTimeout} 15s
*** Test Cases ***
TC001
[Setup] Configuration
Start Test
Wait Until Page Contains Element //*[#id='age-gate-yes'] ${defaultTimeout}
Click Element //a[#id='age-gate-yes']
Wait Until Page Contains Element //a[#href="/profile"] ${defaultTimeout}
Click Element //a[#href="/profile"]
Wait Until Page Contains Element //input[#name="email"] ${defaultTimeout}
Click Element //input[#name="email"]
Input Text //input[#name="email"] johndoe#john.doe
Click Element //input[#name="password"]
Input Text //input[#name="password"] JohnDoe123
Click Element //div[#id='react-component-login-header']//button/div/span[1]
Wait Until Page Does Not Contain Element //div[#id='react-component-login-header']//button/div/span[1] ${defaultTimeout}
[Teardown] End Test
I can see the text being written on field, but when the context of that element is lost, the text is too.
For Android I resolve the problem using the keyword "AppiumLibrary.Press Keycode"
Example, sending a "AppiumLibrary.Press Keycode 67" I managed to send a backspace
https://developer.android.com/reference/android/view/KeyEvent.html

sendkeys command causing exception in selenium webdriver on IOS safari

I have been trying to run some sample Remote WebDriver tests on the Safari browser on the IOS Simulator 7.0 (IPhone) but my tests give an exception every time I try to type in values on a text box. Just trying to use the example from iosdriver
DesiredCapabilities safari = IOSCapabilities.iphone("Safari");
RemoteWebDriver driver = new RemoteWebDriver(new URL("http://<someip>:4444/wd/hub"), safari);
driver.get("http://hp.mobileweb.ebay.co.uk/home");
WebElement search = driver.findElement(By.id("srchDv"));
search.sendKeys("ipod");
search.submit();
gives me the exception
a "org.openqa.selenium.NoSuchElementException: cannot find element for criteria :{"AND":[{"l10n":"none","expected":"UIAElement","matching":"exact","method":"type"},{"l10n":"none","expected":"Address","matching":"exact","method":"name"}" .
Anyone else run into this? It is identifying the element but typing in values fail..It works fine when I try it on firefox on my desktop.
I am no expert, but am familiar with selenium webdriver..
Are you sure that the id for "search " --- ('srchDv') actually exists on the page you are trying to automate?
if so
i would then look into the UIA -Element Hierarchy / Accessibility link to UIA Element Class reference
Hope this is helpful
You have an incorrect selector. The page you are automating does not have an id srchDv. If you are getting the search box, then you need to use:
driver.findElement(By.id("gh-ac")).clear();
driver.findElement(By.id("gh-ac")).sendKeys("ipod");
Also, instead of using submit, personally i would follow the way that your user would commit the action, and that's by clicking the search button.
driver.findElement(By.id("gh-btn")).click();

Unable to Pass parameters to MSI thro Msiexec via command prompt

Hii ppl I am trying to pass parameter thro msiexec in command prompt . The problem is eventhough the parameter is passed properly the value doesnt get reflected in the OnBeforeInstallEvent. Therefore the msi doesnt get installed.
The OnBeforeInstall is written C#.net framework 2.09 (VS 2005) and the event call is given below,
string serverName=Context.Parameters["SERVERNAME"].
For example, In the custom action the parameter is properly declared as /SERVERNAME=[SERVERNAME] so as to access the server name.
There is no problem when I install thro normal UI mode when I pass the parameter thro Msiexec the value doesnt get reflected at the OnBeforeInstall event. I even tried logging the flow of installation thro MSIEXEC /Log , the value gets changed in log ( shown below)
PROPERTY CHANGE: Adding SERVERNAME property. Its value is 'machine1'.
I have given below the msiexec command which I use to pass values,
msiexec.exe /i "C:\Server.msi" /l*v "C:\Server.txt" ALLUSERS=1 REBOOT=ReallySupress TARGETDIR="C:\Program Files\Server" SERVERNAME="machine1" PORT="9090"
but on reaching ONBeforeInstall the value is empty (show below).
Error 1001. An exception occurred in the OnBeforeInstall event handler of Server.ServicesInstaller. --> Installation cannot be continued as some of the installation parameters are not given.
More Info -Server Name cannot be empty.
DEBUG: Error 2769: Custom Action _542E7AC5_7403_434A_874B_DE2872A4848D.install did not close 1 MSIHANDLEs.
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2769.
Moreover, the Operating system is Win 2003 . I even tried the Msiexec in Win XP too Still no go. The SERVERNAME is the property name of one of the textboxes in the TextBox2 Dialog box of setup kit. While observing the installation log , the property change event is recognizing the value change for SERVERNAME but It becomes null while reaching the OnBeforeInstall event don kno wy.
As said earlier it works perfectly in normal UI mode. I even tried modifying the property table of Server.msi thro ORCA(as given below).
Table :Property
Row :SecureCustomProperties Property -> SecureCustomProperties Changed value from NEWERPRODUCTFOUND to NEWERPRODUCTFOUND;SERVERNAME
Still no go
Please Help.
Many thanks,
byfour
Hii PPl,
I fixed it myself I jus removed the rows like CustomTextA_SetProperty_EDIT1 from customaction table and their refferences in other tables using ORCA and it solved the issue.
Many thanks,
byfour

Resources