I am writing one VB code for filling a form in a webpage which contains captcha. I wrote the bellow code to copy the captcha from the website so that the i can load it in my application and complete the form just by typing the captcha manually.
Below is my sample code
Private Sub Command1_Click() On Error GoTo Command1_Click_EH Dim O As Object Set O = WebBrowser1.Document.body.createControlRange() Call O.Add(WebBrowser1.Document.All("captcha")) Call O.execCommand("Copy") Set Picture1.Picture = Clipboard.GetData Set O = Nothing Clipboard.Clear Exit Sub Command1_Click_EH: MsgBox (Err.Description) End Sub Private Sub Form_Load() WebBrowser1.Navigate ("http://www.captchacreator.com/v-examples.html") End Sub
Everything works perfectly in IE8.
But the problem is, In a PC having IE 11 and having FEATURE_BROWSER_EMULATION set to IE11 (11000 ) it gives error like "object doesn't support this property or method" for the line "Call O.Add(WebBrowser1.Document.All("captcha"))"But if FEATURE_BROWSER_EMULATION set to IE 8 then it works without any error. But i want to set FEATURE_BROWSER_EMULATION to IE11 in a PC having IE 11 browser. But in that case i get error as mentioned.
Can anyone please tell me Why does this error comes? and How it can be solved?