[Resolu] Une script qui valide une formulaire Web

Une script qui valide une formulaire Web [Resolu] - VB/VBA/VBS - Programmation

Marsh Posté le 16-12-2015 à 12:50:10    

Bonjour,
 
Voici la page web de l'écran de connexion de ma box :
 

Code :
  1. <!DOCTYPE html>
  2. <html lang="fr">
  3. <head>
  4. <title>Bbox - connexion</title>
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="initial-scale=1.0,user-scalable=no,maximum-scale=1">
  7. <meta name="apple-mobile-web-app-capable" content="yes">
  8. <meta name="HandheldFriendly" content="True">
  9. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  10. <!-- Style Sheets -->
  11. <link href='/css/bbox-merge.css?build=10.1.2' media='screen' rel='stylesheet' type='text/css'> <!--[if LTE IE 8]>
  12. <link rel="stylesheet" type="text/css" media="all" href="/css/fs.gridlock-ie.css?build=10.1.2" />
  13. <![endif]-->
  14. <!--[if lt IE 9]>
  15. <script src="/js/html5shiv.js?build=10.1.2"></script>
  16. <![endif]-->
  17. </head>
  18. <body class="tvw620i feat-checker feat-biloader no-feat-temperature no-feat-orientation no-feat-light feat-usb feat-ht40 feat-5g feat-scan-5g feat-hotspot feat-wps feat-scanwifi no-feat-alert-save no-feat-search remote-off gridlock">
  19. <div class="page-login">
  20. <div class="login-form">
  21. <div class="row">
  22. <div class="desktop-6 desktop-push-3 tablet-4 tablet-push-1 mobile-full panel">
  23. <div class="branding"></div>
  24. <p class="subtitle">Interface d'administration</p>
  25. <form id="login-form">
  26. <div class="textfield">
  27. <input type="password" placeholder="Mot de passe" id="password" name="password">
  28. <div id="password-message" class="alert-message">
  29. </div>
  30. </div>
  31. <div class="cb-container">
  32. <div class="cb">
  33. <input type="checkbox" value="None" id="cb-stay-logged" name="check" checked />
  34. <label for="cb-stay-logged"></label>
  35. </div>
  36. <div class="cb-label">
  37. rester connecté
  38. </div>
  39. </div>
  40. <div class="btn-container btn-login">
  41. <button class="cta-1" type="submit">CONNEXION</button>
  42. </div>
  43. <div class="pwd-lost" style="display:none;">
  44. <a href="" target="_self">mot de passe oublié ?</a>
  45. </div>
  46. </form>
  47. <div class="spacer-hz"></div>
  48. <div class="notify" style="display:none;">
  49. <span class="internet">
  50. <span class="ok"></span>
  51. </span>
  52. <span class="voip">
  53. </span>
  54. <span class="wifi">
  55. </span>
  56. <span class="iptv">
  57. </span>
  58. <span class="usb">
  59. </span>
  60. <span class="parental">
  61. </span>
  62. <span class="night">
  63. </span>
  64. <span class="dl-speed">
  65. </span>
  66. <span class="ul-speed ">
  67. </span>
  68. <span class="voicemail">
  69. </span>
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. <script type="text/javascript" src="/js/messages.js?build=10.1.2"></script><!-- Scripts -->
  76. <script type='text/javascript' src='/js/bbox-merge.js?build=10.1.2'></script><script type="text/javascript" src="/js/login.js?build=10.1.2"></script>
  77. <!--[if LTE IE 9]>
  78. <script type="text/javascript" src="/js/css3-mediaqueries.js?build=10.1.2"></script>
  79. <![endif]-->
  80. </body>
  81. </html>


 
Et voici ma tentative de script pour me connecter :


'Login bbox
Dim objWshShell,IE
 
Set objWshShell = Wscript.CreateObject("Wscript.Shell" )
Set IE = CreateObject("InternetExplorer.Application" )
 
With IE
  .Visible = True
  .Navigate "http://192.168.1.254"
 
'Wait for Browser
  Do While .Busy
    WScript.Sleep 100
  Loop
 
 
 .Document.getElementsByName("password" ).Item(0).Value = "MyPassord"
 .Document.Forms(0).submit
 
 Do While .Busy
    WScript.Sleep 100
  Loop
 
 
 
End With


 
La saisie du mot de passe fonctionne bien, mais pas le "Submit" du formulaire, auriez-vous une piste à me suggérer ?


Message édité par unisev le 20-12-2015 à 21:58:50
Reply

Marsh Posté le 16-12-2015 à 12:50:10   

Reply

Marsh Posté le 20-12-2015 à 21:58:33    

Je n'ai pas réussi
 
J'ai donc remplacé :
.Document.getElementsByName("password" ).Item(0).Value = "MyPassord"  
 
Par :
Send("MyPassord{Enter}" )
 
L'appui sur Enter valide le formulaire...

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed