LoginSignup
0
0

More than 1 year has passed since last update.

cscの作法 その26 WebBrowser

Last updated at Posted at 2020-01-03

概要

cscの作法、調べてみた。
練習問題やってみた。

練習問題

googlの検索ボタンを押せ。

サンプルコード

using System;
using System.Windows.Forms;
using System.Drawing;

class form1: Form {
    WebBrowser wb0;
    form1() {
        Text = "WebBrowser";
        ClientSize = new Size(600, 800);
        Button btn1 = new Button();
        btn1.Location = new Point(50, 20);
        btn1.Text = "test";
        btn1.Click += btn1_Click;
        Controls.AddRange(new Control[] {
            btn1
        });
        wb0 = new WebBrowser();
        wb0.Location = new Point(50, 50);
        wb0.Width = 500;
        wb0.Height = 700;
        Controls.AddRange(new Control[] {
            wb0
        });
        string url = "http://www.google.co.jp/";
        wb0.Navigate(url);
    }
    void btn1_Click(object sender, System.EventArgs e) {
        wb0.Focus();
        wb0.Document.All.GetElementsByName("q")[0].InnerText = "ohisamallc";
        SendKeys.Send("{tab}");
        SendKeys.Send("{enter}");
    }
    [STAThread]
    public static void Main() {
        Application.Run(new form1());
    }
}




以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0