We're trying to automate one of our Test cases on iOS (iPad) with appium-java client 8.
The test step is like below:
Fetch element from TextField
Click on that textField
Clear the existing value and enter the new value
Test Result:
We're able to fetch the value from the TextField
Click action is successful but the actual interaction is not working. Due to which the sendkeys also not working
Note: The above scenario was working fine with approach 1 with TestProject. Now we've migrated the framework to appium. After that only it's failing few scenarios
Please review the attached DOMAppium Inspector- Actual Element
Tried Approaches
1. Approach 1
{
element.getAttribute("value");
element.click();
element.sendkeys("newvalue");
}
->
Test Result:
We're able to fetch the value from the TextField
Click action is successful but the actual interaction is not working. Due to which the sendkeys also not working
2. Actions Class
{
Actions action = new Actions(appiumDriver);
WebElement element = appiumDriver.findElement(byLocator);
element.getAttribute("value");
action.moveToElement(element).click().perform();
action.moveToElement(element).sendKeys(Keys.chord(Keys.CONTROL, "a")).perform();
element.clear();
element.sendKeys(""+text);
appiumDriver.hideKeyboard();
}
Test Result:
We're able to fetch the value from the TextField
Click action is successful but the actual interaction is not working. Due to which the sendkeys also not working
3. With W3C action
{
PointerInput FINGER = new PointerInput(PointerInput.Kind.TOUCH, "finger");
Sequence tap = new Sequence(FINGER, 1)
.addAction(FINGER.createPointerMove(Duration.ofMillis(0),PointerInput.Origin.viewport(), (element.getRect().x + (element.getSize().width/2)), element.getRect().y))
.addAction(FINGER.createPointerDown(0))
.addAction(new Pause(FINGER, Duration.ofMillis(200)))
.addAction(FINGER.createPointerUp(0));
appiumDriver.perform(Arrays.asList(tap));
}
Test Result:
We're able to fetch the value from the TextField
Click action is working fine. However it's clicking on different location. Same thing happening when we try to find element in appium inspector. The locator is correct but still the coordinates are different one.
Find element with xpath-Highlighing coordinates
Related
When I close a SysQueryForm (by clicking on Ok button), a system generated dialog box appears on the form as shown below:-
I am writing a unit test to close this dialogue box but when I try to close the sysbox form by using the X++ code below:-
using (SysBoxFormAdaptor sysBoxForm = SysBoxFormAdaptor::attach())
{
sysBoxForm.CloseCtrl().click();
}
I am getting the following error:-
Cannot access form CPool id 3: topmost form is SysBoxForm id 181<\error>
There are open forms on the client: {"CPool (3)", "SysBoxForm (181)"}<\error>
To give a context, CPool is the form on which selecting a button opens a SysQueryForm and after selecting a criteria on the SysQueryForm for a particular table due to some join issue this system dialogue comes which cannot be fixed as of now.
I have tried some other ways as well but they too end up throwing the same error.
So the issue is that SysBoxForm is not closing.
Since this is a system generated (kernel level) dialogue, does anyone know how to close it?
So after further debugging I found out that two SysBoxForms are getting opened, one on top of the other. So closed them by attaching SysBoxFormAdaptor twice and it worked:-
using (SysBoxFormAdaptor sysBoxForm = SysBoxFormAdaptor::attach())
{
sysBoxForm.CloseCtrl().click();
}
using (SysBoxFormAdaptor sysBoxForm = SysBoxFormAdaptor::attach())
{
sysBoxForm.CloseCtrl().click();
}
This was the reason I was getting the error that a SysBoxForm is open.
I have a simple Tosca Test Case Template which takes data from a TestCaseDesign Sheet. The scenario is simple - It just launches the browser, navigates to a login page, enters username and password and clicks the login button. I have just two values for username and two values for password in the TestCaseDesign Sheet.
I linked the TestCaseDesign Sheet with the Test Case Template and generated two test instances.
Now, when I select and run these two test instances using the Scratchbook, I would like that the browser automatically closes after each test instance passes or fails so that the next test instance can open a new browser as a first step.
Also, I would like to take a screenshot before the browser closes.
How can I achieve that using Tosca?
The event raised by clicking on a phone number will either be of the form "tel:" or "skype:". Here are the steps I've followed so far to enable a window navigation rule to capture the event, and I've attached events to the rule to actually see the action get fired in the Debugger. Still, even with navigation rules set to capture tel: and skype:, the action will never fire in USD Debugger. Here is the general approach I've used so far (From another post):
Create a Windownavigation rule.
Don't put anything into the entity Settings but put "tel:" or "skype:" into the URL TextBox.
Routetype will be Popup
Target will be Tab (or registercard, at least I think that's the name for it in english - I'm using a german one)
Define None as Action in result for your Windownavigationrule
Create your own Action to resolve when the Navigation rule is triggered
Set your own hosted control (In this case I use the CTIConnector class.)
Define an Actionname for your Action that will be exectued (I named it "MakeCall" in CRM)
Set Data to [[SUBJECTURL]] so the URL ist given to the Action als Parameter.
Override the method DoAction from your hosted control
Just 2 -3 points to verify.
Do you have a UII action with the name "MakeCall"? If that is there then only your code will be triggered from DoAction.
In case, if you have above in place please check whether your action calls and other records are added to the respective configuration reocrd?
I was developing an app that in the first state you choose a date range using dataFields then you press a button to go to another state and generate a datagrid showing an employee list and another scrollable datagrid with its columns generated dynamically having the worked hours for every employee in every date.
The step sequence to get the error message is:
You choose a date range for example: from 01/01/2013 to 01/31/2013
You press generate button (The app change the currentState = "EmployeeList" and all is OK)
You press the back button (you return to initial state and all is OK)
If you change the date range having more days than before date range then all is OK
If you change the date range having less days than before date range then next error is reached
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at mx.controls.dataGridClasses::DataGridBase/http://www.adobe.com/2006/flex/mx/internal::columnHeaderWordWrap()
at mx.controls.dataGridClasses::DataGridItemRenderer/validateProperties()
at mx.managers::LayoutManager/validateClient()
at mx.controls.dataGridClasses::DataGridHeader/updateDisplayList()
at mx.core::UIComponent/validateDisplayList()
at mx.managers::LayoutManager/validateDisplayList()
at mx.managers::LayoutManager/doPhasedInstantiation()
at mx.managers::LayoutManager/doPhasedInstantiationCallback()
and if you google it then some results take to visit apache bug reporting site
https://issues.apache.org/jira/browse/FLEX-22108
And there is no more...
But I found how to solve it!
To solve it first of all I was googling a lot and i looks like no one got this error and I discover that is a Flex Bug reported to Apache. And I was analyzing the original code from DataGrid.as and DataGridColumn.as to think about a possible solution and I was making some tests and nothing work.
What I did and I hope it will be useful to someone
when you click the back button, inside the backbutton_clickEventLister() and before currentState="";
I just set columns array to new Array();
protected function bttnBack_clickEventHandler(event:Event) : void {
// This code line solved it
dtGrdWorkedHours.columns = new Array();
// Make sure of code it before state change stament
currentState = "";
}
Take a standard web page with lots of text fields, drop downs etc.
What is the most efficient way in webdriver to fill out the values and then verify if the values have been entered correctly.
You only have to test that the values are entered correctly if you have some javascript validation or other magic happening at your input fields. You don't want to test that webdriver/selenium works correctly.
There are various ways, depending if you want to use webdriver or selenium. Here is a potpourri of the stuff I'm using.
Assert.assertEquals("input field must be empty", "", selenium.getValue("name=model.query"));
driver.findElement(By.name("model.query")).sendKeys("Testinput");
//here you have to wait for javascript to finish. E.g wait for a css Class or id to appear
Assert.assertEquals("Testinput", selenium.getValue("name=model.query"));
With webdriver only:
WebElement inputElement = driver.findElement(By.id("input_field_1"));
inputElement.clear();
inputElement.sendKeys("12");
//here you have to wait for javascript to finish. E.g wait for a css Class or id to appear
Assert.assertEquals("12", inputElement.getAttribute("value"));
Hopefully, the results of filling out your form are visible to the user in some manner. So you could think along these BDD-esque lines:
When I create a new movie
Then I should see my movie page
That is, your "new movie" steps would do the field entry & submit. And your "Then" would assert that the movie shows up with your entered data.
element = driver.find_element(:id, "movie_title")
element.send_keys 'The Good, the Bad, the Ugly'
# etc.
driver.find_element(:id, "submit").click
I'm just dabbling in this now, but this is what I came up with so far. It certainly seems more verbose than something like Capybara:
fill_in 'movie_title', :with => 'The Good, the Bad, the Ugly'
Hope this helps.