1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to remove element attribute in webbrowser

Discussion in 'Visual Basic .NET' started by Axlii1, Feb 16, 2014.

  1. Axlii1

    Axlii1 Newbie

    Joined:
    Dec 20, 2013
    Messages:
    2
    Likes Received:
    0
    Hello!
    I am using Microsoft Visual Basic 2010 Express. I need to remove "disabled" attribute from this element in webbrowser.
    HTML:
    <input id="RegisterBtn" class="btn btn-primary" type="submit" disabled="false" name="" value="Register"></input>
    It must look like this:

    HTML:
    <input id="RegisterBtn" class="btn btn-primary" type="submit" name="" value="Register"></input>
    I tried to change value of "disabled" to "" but registration doesn't work.
    How can I do it?
    Thanks.
     
  2. jazzc

    jazzc Moderator Staff Member Moderator Jr. VIP

    Joined:
    Jan 27, 2009
    Messages:
    2,468
    Likes Received:
    10,143
  3. Axlii1

    Axlii1 Newbie

    Joined:
    Dec 20, 2013
    Messages:
    2
    Likes Received:
    0
    Thank you.
    Can you tell me how can I remove it?
    I tried
    Code:
    Browser.Document.GetElementById("RegisterBtn").OuterHtml = "<input id='RegisterBtn' class='btn btn-primary' type='submit' name='' value='Register'>"
    But registration still doesn't work.


    I want to make app which will create account here dlh . net/en/register

    My code:

    Code:
    Browser.Document.GetElementById("RegisterForm-element-4").SetAttribute("value", RandomLet(7))
    Browser.Document.GetElementById("RegisterForm-element-5").SetAttribute("value", RandomLet(7))
    Browser.Document.GetElementById("RegisterEmail").SetAttribute("value", EmailBox.Text)
    Browser.Document.GetElementById("RegisterUsername").SetAttribute("value", RandomLet(9))
    Browser.Document.GetElementById("RegisterEmail").SetAttribute("classname", "marksuccess")
    Browser.Document.GetElementById("RegisterUsername").SetAttribute("classname", "marksuccess")
    captchaform.captchabox.Load(Browser.Document.GetElementById("recaptcha_challenge_image").GetAttribute("src"))
    
    'captcha solving code 
    
    Browser.Document.GetElementById("RegisterBtn").OuterHtml = "<input id='RegisterBtn' type='submit' name='' value='Register'>"
    Browser.Document.GetElementById("RegisterBtn").Focus()
    Browser.Document.GetElementById("RegisterBtn").InvokeMember("click")
    
    I am getting error "User Exists" ( when there is no user with this nickname ).
    Thanks.
     
  4. jazzc

    jazzc Moderator Staff Member Moderator Jr. VIP

    Joined:
    Jan 27, 2009
    Messages:
    2,468
    Likes Received:
    10,143
    It 's been a very long time since I last coded in VB.NET, someone else will have to provide specifics.
     
  5. Psychop1

    Psychop1 Registered Member

    Joined:
    Jul 30, 2010
    Messages:
    63
    Likes Received:
    19
    It would seem you only need to set the disabled attribute to "true". However, that would only disable the button so that it can't be clicked after submission has began. I'm not sure this is related to your registration problem.
     
  6. zohar

    zohar Newbie

    Joined:
    Jun 24, 2014
    Messages:
    44
    Likes Received:
    5
    Try the lazy approach..inject javascript in your webbrowser that does the job for you. If you don't know how to code in Javascript very well, then no problem, Google is your friend.

    In my WebBrowser projects I always make sure to outsource difficult operations to Javascript, and it works every single time.
    Sites like stackoverflow.com etc are filled with easy to implement javascript codes.
     
    Last edited: Nov 14, 2014