Reputation: 3891
I am developing automation windows application in C# using web browser control. To set the values to the controls, I am using SetAttribute property. It works fine for all the controls but the text box which consist watermarking
For example
The following is my coding
WebBrowser.Document.GetElementById("ctl00_Content1_dob_txbx").SetAttribute("value", "09/17/1976");
While running the application, the textbox holds the value like watermarking
For example
while clicking the submit button the date getting vanish. How can I set the date in the watermarking text box?
How can I achieve the following output
Note: In the website the Watermark achieved by ajax WatermarkExtender
Upvotes: 0
Views: 1223
Reputation: 3891
I have found the solution I have set the value in WebBrowser_ProgressChanged event now its works fine
private void automationWebBrowser_ProgressChanged(object sender, WebBrowserProgressChangedEventArgs e)
{
if (automationWebBrowser.Document.GetElementById("ctl00_Content1_dob_txbx") != null)
automationWebBrowser.Document.GetElementById("ctl00_Content1_dob_txbx").SetAttribute("value", "09/17/1976");
}
Upvotes: 1