Skip to content
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

Develop 2021 release wave2 #1235

Open
wants to merge 1 commit into
base: develop-2021ReleaseWave2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -398,25 +398,25 @@ public static class AppElements

//Grid
{ "Grid_Container" , "//div[@data-id='data-set-body-container']"},
{ "Grid_PCFContainer" , "//div[@ref='eViewport']"},
{ "Grid_PCFContainer" , "//div[@data-id='entity_control_container']"},
{ "Grid_QuickFind" , "//*[contains(@id, \'quickFind_text\')]"},
{ "Grid_NextPage" , "//button[contains(@data-id,'moveToNextPage')]"},
{ "Grid_PreviousPage" , "//button[contains(@data-id,'moveToPreviousPage')]"},
{ "Grid_FirstPage" , "//button[contains(@data-id,'loadFirstPage')]"},
{ "Grid_SelectAll" , "//button[contains(@title,'Select All')]"},
{ "Grid_ShowChart" , "//button[contains(@aria-label,'Show Chart')]"},
{ "Grid_NextPage" , "//button[contains(@id,'nextPage')]"},
{ "Grid_PreviousPage" , "//button[contains(@id,'previousPage')]"},
{ "Grid_FirstPage" , "//button[contains(@id,'firstPage')]"},
{ "Grid_SelectAll" , "//button[contains(@class, 'cc-ds-header-select-all-btn')]"},
{ "Grid_ShowChart" , "//button[@id='ShowChartPane-button']"},
{ "Grid_JumpBar" , "//*[@id=\"JumpBarItemsList\"]"},
{ "Grid_FilterByAll" , "//*[@id=\"All_link\"]"},
{ "Grid_RowsContainerCheckbox" , "//div[@role='checkbox']" },
{ "Grid_RowsContainer" , "//div[contains(@role,'grid')]"},
{ "Grid_Rows" , "//div[@ref='centerContainer']//div[@role='rowgroup']//div[contains(@role,'row')]"},
{ "Grid_Row" , "//div[@data-id='entity_control-pcf_grid_control_container']//div[@ref='centerContainer']//div[@role='rowgroup']//div[@row-index=\'[INDEX]\']"},
{ "Grid_LastRow" , "//div[@data-id='entity_control-pcf_grid_control_container']//div[@ref='centerContainer']//div[@role='rowgroup']//div[contains(@class, 'ag last-row')]"},
{ "Grid_Rows" , "//div[@data-id='entity_control_container']//div[@role='grid']//div[contains(@role,'row')]"},
{ "Grid_Row" , "//div[@data-id='entity_control_container']//div[@role='grid']//div[@aria-rowindex=\'[INDEX]\']"},
{ "Grid_LastRow" , "//div[@data-id='entity_control_container']//div[@role='grid']//div[contains(@class, 'ag last-row')]"},
{ "Grid_Control", "//div[contains(@data-lp-id, 'MscrmControls.Grid.PCFGridControl')]" },
{ "Grid_Columns" , "//div[contains(@ref,'eHeaderContainer')]"},
{ "Grid_ChartSelector" , "//span[contains(@id,'ChartSelector')]"},
{ "Grid_ChartViewList" , "//ul[contains(@role,'listbox')]"},
{ "Grid_SortColumn", "//div[contains(@ref,'eHeaderContainer')]//label[@title='[COLNAME]']"},
{ "Grid_SortColumn", "//div[contains(@class,'colheaders')]//div[@title='[COLNAME]']"},
{ "Grid_Cells", ".//div[@role='gridcell']"},
{ "Grid_CellContainer" ,"//div[@role='grid'][@data-id='grid-cell-container']"},
{ "Grid_ViewSelector" , "//button[contains(@id,'ViewSelector')]" },
Expand Down Expand Up @@ -469,7 +469,7 @@ public static class AppElements
{ "Entity_SubGrid_Row" , "//div[@ref='centerContainer']//div[@role='rowgroup']//div[@row-index=\'[INDEX]\']"},
{ "Entity_SubGrid_LastRow" , "//div[@ref='centerContainer']//div[@role='rowgroup']//div[contains(@class, 'ag-row-last')]"},
{ "Entity_SubGridTitle", "//div[contains(text(), '[NAME]')]" },
{ "Entity_SubGridContents", "//div[@id=\"dataSetRoot_[NAME]\"]" },
{ "Entity_SubGridContents", "//div[@data-id='dataSetRoot_[NAME]']" },
{ "Entity_SubGridList", "//div[@data-id='[NAME]-pcf_grid_control_container']//div[@ref='centerContainer']//div[@role='rowgroup']//div[@role='row']" },
{ "Entity_SubGridListCells", ".//div[@class='ag-center-cols-viewport']//div[@role='rowgroup']" },
{ "Entity_SubGridViewPickerButton", ".//span[contains(@id, 'ViewSelector') and contains(@id, 'button')]" },
Expand Down
20 changes: 6 additions & 14 deletions Microsoft.Dynamics365.UIAutomation.Api.UCI/WebClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1548,14 +1548,14 @@ internal BrowserCommandResult<bool> OpenRecord(int index, int thinkTime = Consta
int lastRowInCurrentView = 0;
while (!lastRow)
{
if (!driver.HasElement(By.XPath(AppElements.Xpath[AppReference.Grid.Row].Replace("[INDEX]", (index).ToString()))))
if (!driver.HasElement(By.XPath(AppElements.Xpath[AppReference.Grid.Row].Replace("[INDEX]", (index+2).ToString()))))
{
lastRowInCurrentView = ClickGridAndPageDown(driver, grid, lastRowInCurrentView);
}
else
{
gridRow = driver.FindElement(By.XPath
(AppElements.Xpath[AppReference.Grid.Row].Replace("[INDEX]", index.ToString())));
(AppElements.Xpath[AppReference.Grid.Row].Replace("[INDEX]", (index+2).ToString())));
lastRow = true;
}
if (driver.HasElement(By.XPath(AppElements.Xpath[AppReference.Grid.LastRow])))
Expand All @@ -1564,8 +1564,8 @@ internal BrowserCommandResult<bool> OpenRecord(int index, int thinkTime = Consta
}
}
if (gridRow == null) throw new NotFoundException($"Grid Row {index} not found.");
var xpathToGrid = By.XPath("//div[contains(@data-lp-id,'MscrmControls.Grid')]");
var gridContainer = driver.FindElement(By.XPath("//div[contains(@data-lp-id,'MscrmControls.Grid')]"));
var xpathToGrid = By.XPath("//div[contains(@class,'MscrmControls.Grid')]");
var gridContainer = driver.FindElement(By.XPath("//div[contains(@class,'MscrmControls.Grid')]"));
IWebElement control = driver.WaitUntilAvailable(xpathToGrid);

Func<Actions, Actions> action;
Expand All @@ -1574,16 +1574,8 @@ internal BrowserCommandResult<bool> OpenRecord(int index, int thinkTime = Consta
else
action = e => e.DoubleClick();

var xpathToCell = By.XPath(AppElements.Xpath[AppReference.Grid.Row].Replace("[INDEX]", index.ToString()));
control.WaitUntilClickable(xpathToCell,
cell =>
{
var emptyDiv = cell.FindElement(By.TagName("div"));
//driver.Perform(action, cell, cell.LeftTo(emptyDiv));
driver.Perform(action, cell, null);
},
$"An error occur trying to open the record at position {index}"
);
var xpathToCell = By.XPath(AppElements.Xpath[AppReference.Grid.Row].Replace("[INDEX]", (index + 2).ToString()) + "//div[@aria-colindex='2']");
driver.Perform(action, driver.FindElement(xpathToCell));

driver.WaitForTransaction();
return true;
Expand Down