microsoft / EasyRepro

Automated UI testing API for Dynamics 365
MIT License
523 stars 289 forks source link

[Bug] WaitUntilVisible(xpath for input in new contact page ) always returns false and fails to setValue #924

Open billyzh1 opened 4 years ago

billyzh1 commented 4 years ago

Backgound: I am in the middle of automating dynamics 365 regression suite and I met an issue of creating a new contact page and I failed to setValue to first name, last name, etc with the command SetValue or SendKeys(value) due to the display=false. Actually the element like first name is shown on the page and the script found the element and I could update its value with javascript but I could not save it. I hope you guys can give some solution to help me create a new contact page and save it successfully

Issue Summary:

Navigated to sales -> contact page and click new button and waited for page ready and then switched to a ready and right content Iframe and tried finding the input element of first name

IWebElement IFramElement =_driver.WaitUntilAvailable(By.XPath("//iframe[@name='contentIFrame1']")); _driver.SwitchTo().Frame(IFramElement); Thread.Sleep(100000); _driver.WaitUntilVisible(By.XPath("//td[@id='firstname_d']//input[@id='firstname_i']")); or _driver.WaitUntilVisible(By.XPath("//input[@id='firstname_i']")); But always got the valid element id an enabled=true, displayed =false, location (x=0, y =0 ) size (width =0, height = 0)response from dynamics page. The xpath is right and I am pretty sure it is not related with timing issue. I waited for 10+ mins and it always returned displayed =false.

setValue for the input element and got the exception as below. I think it was caused by displayed =false

{"The command failed because the specified element is not pointer or keyboard interactable."}

Environment: Dynamics 365 Version 1710 (9.1.0.20151) online MicrosoftWebDriver Version: 10.0.18362.836 Selenium C# web driver bindings 3.141.0 Microsoft Edge 44.18362.449.0 Microsoft EdgeHTML 18.18363

image

Solution or Workaround?

I saw the html script and observed the label and title was updated actually when I typed firstnamne "4444444". I used javascript to update the tile and label value as a workaround and the value was set on the page and I could see it. I did the the thing for other fields. But when I clicked the save button and I could not save and got prompt "Please provide the value for the first name". It seemed like the value I typed did not pass data validation. Any idea how to set value and save the update.

billyzh1 commented 4 years ago

Can someone help me please? I am struggling for the fix for a long time and blocked by this.

vcinampudi commented 4 years ago

you need to write a custom method where you pass XPath or CSS Selector based on that you can make it wait until the element load.

billyzh1 commented 4 years ago

to write a custom method where you pass XPath or CSS Selector based on that you can make it wait until the element load.

Thank you so much for your reply. Actually, I am sure the element and page are loaded successfully and I could locate the element but displayed property of the returned element is set to be false. I cannot click the element and I cannot fill data either.