9 Replies - 1472 Views - Last Post: 09 July 2014 - 07:29 AM Rate Topic: -----

#1 elinka  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 08-July 14

Problem with clicking a button in webBrowser control

Posted 08 July 2014 - 03:25 PM

I'm getting this strange problem with the webBrowser control that google can't find an answer for. When I click a button I get redirected to a page with just the letters 'e4' makes no sense to me?? is this a site problem or something to do with the webBrowser control?
Is This A Good Question/Topic? 0
  • +

Replies To: Problem with clicking a button in webBrowser control

#2 andrewsw  Icon User is offline

  • blow up my boots
  • member icon

Reputation: 6444
  • View blog
  • Posts: 26,066
  • Joined: 12-December 12

Re: Problem with clicking a button in webBrowser control

Posted 08 July 2014 - 03:47 PM

Post the code, or link/html, behind the button.

If you are programmatically clicking the button then post this code as well.
Was This Post Helpful? 0
  • +
  • -

#3 elinka  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 08-July 14

Re: Problem with clicking a button in webBrowser control

Posted 08 July 2014 - 04:01 PM

View Postandrewsw, on 08 July 2014 - 03:47 PM, said:

Post the code, or link/html, behind the button.

If you are pro programmatically clicking the button then post this code as well.


This happens wether I do it programmatically or manually in the webBrowser control. But here's the code if I automate it.

       private void Download(string img)
        {
            string url = img;
            
            WebClient client = new WebClient();
            client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted);
            client.DownloadFileAsync(new Uri(url), @"picture1.png");
            
        }

        void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
        {

            HtmlDocument doc = this.web.Document;
            doc.GetElementById("text_field").SetAttribute("Value", "blah blah");

            HtmlElement btn1 = web.document.GetElementById("button1");
            btn1.InvokeMember("click");

        }


And this is the HTML behind the button
<input type="submit" value="ROLL!" id="button1" class="button">

Was This Post Helpful? 0
  • +
  • -

#4 Skydiver  Icon User is online

  • Code herder
  • member icon

Reputation: 5951
  • View blog
  • Posts: 20,400
  • Joined: 05-May 12

Re: Problem with clicking a button in webBrowser control

Posted 09 July 2014 - 05:38 AM

So it works correctly if you manually click when the button is in a web browser, but does not work if you manually click when the button is in a web browser control? In that case, I would suspect that the web page is doing something that is browser dependent.
Was This Post Helpful? 0
  • +
  • -

#5 elinka  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 08-July 14

Re: Problem with clicking a button in webBrowser control

Posted 09 July 2014 - 06:51 AM

Hi, I was thinking the same but even more strange is that the same code worked one day and then the following morning it stopped working.. :/ I have no idea how to overcome this issue :/
Was This Post Helpful? 0
  • +
  • -

#6 ybadragon  Icon User is offline

  • Home Owner
  • member icon

Reputation: 571
  • View blog
  • Posts: 2,647
  • Joined: 11-May 12

Re: Problem with clicking a button in webBrowser control

Posted 09 July 2014 - 06:57 AM

Did something on the webpage change? put a breakpoint in your code where you are getting the HTML element. does it contain any value when you hover over it? Is it the correct value?
Was This Post Helpful? 0
  • +
  • -

#7 Skydiver  Icon User is online

  • Code herder
  • member icon

Reputation: 5951
  • View blog
  • Posts: 20,400
  • Joined: 05-May 12

Re: Problem with clicking a button in webBrowser control

Posted 09 July 2014 - 07:10 AM

View Postelinka, on 09 July 2014 - 09:51 AM, said:

Hi, I was thinking the same but even more strange is that the same code worked one day and then the following morning it stopped working.. ://> I have no idea how to overcome this issue ://>


Chances are that the site owner of the website noticed somebody was trying to automate access to their page and so they have started the arms race to prevent it.
Was This Post Helpful? 1
  • +
  • -

#8 elinka  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 08-July 14

Re: Problem with clicking a button in webBrowser control

Posted 09 July 2014 - 07:12 AM

it's not my site but I can't see any changes.. i've been debugging for 2 days. I can see this landing on freelancers :nottalkingtoyou: haha
Was This Post Helpful? 0
  • +
  • -

#9 elinka  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 08-July 14

Re: Problem with clicking a button in webBrowser control

Posted 09 July 2014 - 07:24 AM

View PostSkydiver, on 09 July 2014 - 07:10 AM, said:

View Postelinka, on 09 July 2014 - 09:51 AM, said:

Hi, I was thinking the same but even more strange is that the same code worked one day and then the following morning it stopped working.. ://>/> I have no idea how to overcome this issue ://>/>


Chances are that the site owner of the website noticed somebody was trying to automate access to their page and so they have started the arms race to prevent it.


that also come to mind, i wonder what e2 means though.. :/
Was This Post Helpful? 0
  • +
  • -

#10 Skydiver  Icon User is online

  • Code herder
  • member icon

Reputation: 5951
  • View blog
  • Posts: 20,400
  • Joined: 05-May 12

Re: Problem with clicking a button in webBrowser control

Posted 09 July 2014 - 07:29 AM

I suggest contacting the site owner and confirm that you are allowed to do what you are doing. If they say no, then abandon this project.

I suggest contacting the site owner and confirm that you are allowed to do what you are doing. If they say no, then abandon this project.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1