Hi
Currently, I use customized code to find object
But on firefox , I can not find it. I see log file, count of htmlCollection =0
public void DeleteSheet_CodedStep()
{
object sheetName = GetExtractedValue("SheetName");
Assert.IsNotNull(sheetName, "variable SheetName on calling method is not defined");
string sheetNameString = (sheetName as string).Trim();
Log.WriteLine(string.Format("{0} variable is defined", sheetNameString));
sheetNameString = Utility.HandleLongString(sheetNameString);
Log.WriteLine(sheetNameString);
sheetNameString = Utility.HtmlEncode(sheetNameString);
Log.WriteLine(sheetNameString);
HtmlDiv htmlDiv = Find.ById<HtmlDiv>("dnn_ctr431_ViewMediaResource_UP");
Log.WriteLine("htmlDiv"+htmlDiv);
//Add find on firefox until find out result
/* if (ActiveBrowser.BrowserType == BrowserType.FireFox || ActiveBrowser.BrowserType == BrowserType.Chrome )
{
while (htmlDiv == null)
{
ActiveBrowser.RefreshDomTree();
htmlDiv = Find.ById<HtmlDiv>("dnn_ctr431_ViewMediaResource_UP");
}
}
*/
IList<HtmlDiv> htmlDivsCollection = htmlDiv.Find.AllByAttributes<HtmlDiv>("class=body-component");
/* if (ActiveBrowser.BrowserType == BrowserType.FireFox )
{
while (htmlDivsCollection.Count() == 0)
{
ActiveBrowser.RefreshDomTree();
htmlDivsCollection = htmlDiv.Find.AllByAttributes<HtmlDiv>("class=body-component");
}
}
*/
Log.WriteLine(string.Format("{0} html div count found", htmlDivsCollection.Count.ToString()));
foreach(HtmlDiv listItem in htmlDivsCollection)
{
IList<HtmlDiv> contentColletion = listItem.Find.AllByAttributes<HtmlDiv>("class=body-component-content");
Log.WriteLine(contentColletion[0].TextContent);
if (String.Compare(sheetNameString, contentColletion[0].TextContent) == 0)
{
Log.WriteLine("mediaSheet found");
IList<HtmlControl> default_sheet = listItem.Find.AllByAttributes<HtmlControl>("class=body-component-menu-delete");
if(default_sheet != null && default_sheet.Count > 0)
{
Log.WriteLine(string.Format("language tile object {0} deleted", sheetNameString));
listItem.MouseHover();
default_sheet[0].MouseClick();
}
break;
}
Please refer attachment
Thanks so much
Currently, I use customized code to find object
But on firefox , I can not find it. I see log file, count of htmlCollection =0
public void DeleteSheet_CodedStep()
{
object sheetName = GetExtractedValue("SheetName");
Assert.IsNotNull(sheetName, "variable SheetName on calling method is not defined");
string sheetNameString = (sheetName as string).Trim();
Log.WriteLine(string.Format("{0} variable is defined", sheetNameString));
sheetNameString = Utility.HandleLongString(sheetNameString);
Log.WriteLine(sheetNameString);
sheetNameString = Utility.HtmlEncode(sheetNameString);
Log.WriteLine(sheetNameString);
HtmlDiv htmlDiv = Find.ById<HtmlDiv>("dnn_ctr431_ViewMediaResource_UP");
Log.WriteLine("htmlDiv"+htmlDiv);
//Add find on firefox until find out result
/* if (ActiveBrowser.BrowserType == BrowserType.FireFox || ActiveBrowser.BrowserType == BrowserType.Chrome )
{
while (htmlDiv == null)
{
ActiveBrowser.RefreshDomTree();
htmlDiv = Find.ById<HtmlDiv>("dnn_ctr431_ViewMediaResource_UP");
}
}
*/
IList<HtmlDiv> htmlDivsCollection = htmlDiv.Find.AllByAttributes<HtmlDiv>("class=body-component");
/* if (ActiveBrowser.BrowserType == BrowserType.FireFox )
{
while (htmlDivsCollection.Count() == 0)
{
ActiveBrowser.RefreshDomTree();
htmlDivsCollection = htmlDiv.Find.AllByAttributes<HtmlDiv>("class=body-component");
}
}
*/
Log.WriteLine(string.Format("{0} html div count found", htmlDivsCollection.Count.ToString()));
foreach(HtmlDiv listItem in htmlDivsCollection)
{
IList<HtmlDiv> contentColletion = listItem.Find.AllByAttributes<HtmlDiv>("class=body-component-content");
Log.WriteLine(contentColletion[0].TextContent);
if (String.Compare(sheetNameString, contentColletion[0].TextContent) == 0)
{
Log.WriteLine("mediaSheet found");
IList<HtmlControl> default_sheet = listItem.Find.AllByAttributes<HtmlControl>("class=body-component-menu-delete");
if(default_sheet != null && default_sheet.Count > 0)
{
Log.WriteLine(string.Format("language tile object {0} deleted", sheetNameString));
listItem.MouseHover();
default_sheet[0].MouseClick();
}
break;
}
Please refer attachment
Thanks so much