Attach image in Internet Explorer
Posted: Fri Jun 20, 2014 12:44 am
Hello,
I am trying to attach an image in a web application. I have managed to get the code to work in Chrome because it detects that element. However, it does not work in cross browser testing.
Here is what I have:
The code will run correctly for the first browser, assuming Chrome is the first browser in the test. However, if I run it in FireFox it will time out.
I assume the if statement is incorrect, but was wondering if someone has any pointers. I have attached a screenshot of the current repository
Thanks!
I am trying to attach an image in a web application. I have managed to get the code to work in Chrome because it detects that element. However, it does not work in cross browser testing.
Here is what I have:
Code: Select all
private void Chrome_PathURL_ComboBox(string folderName)
{
string baseDirectory = AppDomain.CurrentDomain.BaseDirectory;
DirectoryInfo parentDir = Directory.GetParent(baseDirectory);
string updatedDirectory = parentDir.Parent.FullName;
updatedDirectory = (updatedDirectory + folderName);
Report.Log(ReportLevel.Info, "Keyboard", "Key sequence 'yourtext' with focus on 'Open.PathURL_ComboBox'.", repo.Chrome_Upload.ChromePathURL_ComboBoxInfo);
repo.Chrome_Upload.ChromePathURL_ComboBox.PressKeys(updatedDirectory + "{Enter}");
}
private void FireFox_PathURL_ComboBox(string folderName)
{
string baseDirectory = AppDomain.CurrentDomain.BaseDirectory;
DirectoryInfo parentDir = Directory.GetParent(baseDirectory);
string updatedDirectory = parentDir.Parent.FullName;
updatedDirectory = (updatedDirectory + folderName);
Report.Log(ReportLevel.Info, "Keyboard", "Key sequence 'yourtext' with focus on 'Open.PathURL_ComboBox'.", repo.FireFox_Upload.FireFoxPathURL_ComboBoxInfo);
repo.FireFox_Upload.FireFoxPathURL_ComboBox.PressKeys(updatedDirectory + "{Enter}");
}
private void IE_PathURL_ComboBox(string folderName)
{
string baseDirectory = AppDomain.CurrentDomain.BaseDirectory;
DirectoryInfo parentDir = Directory.GetParent(baseDirectory);
string updatedDirectory = parentDir.Parent.FullName;
updatedDirectory = (updatedDirectory + folderName);
Report.Log(ReportLevel.Info, "Keyboard", "Key sequence 'yourtext' with focus on 'Open.PathURL_ComboBox'.", repo.IE_Upload.IEPathURL_ComboBoxInfo);
repo.IE_Upload.IEPathURL_ComboBox.PressKeys(updatedDirectory + "{Enter}");
}
public void BrowserImageFile(string folderName, string browser)
{
{
if (repo.Chrome_Upload.ChromePathURL_ComboBox.Visible.Equals(true) )
{
Chrome_PathURL_ComboBox(folderName);
}
else if (repo.FireFox_Upload.FireFoxPathURL_ComboBox.Visible.Equals(true) )
{
FireFox_PathURL_ComboBox(folderName);
}
else if (repo.IE_Upload.Self.Visible.Equals(true) )
{
IE_PathURL_ComboBox(folderName);
}
}
}
}
I assume the if statement is incorrect, but was wondering if someone has any pointers. I have attached a screenshot of the current repository
Thanks!