Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
Help us understand the problem. What is going on with this article?

Excel VBA + SeleniumBasic でサイボウズ操作、在席ステータスを変更する

環境

windows10
Excel(Office365)
Google Chrome ver 83.0.4103.106
SeleniumBasic ver 2.0.9.0
chromedriver ver 83.0.4103.39
サイボウズ試用版

サイボウズログイン、在席ステータスを取得

Sub 席空きに変更する_Click()
    Dim Driver As New Selenium.WebDriver
    Dim seatStatus As String

    ' Chromeを開く
    Driver.Start "chrome"
    ' サイボウズを開く
    Driver.Get "https://xxx.xxx.xxx"
    ' ログイン名を入力
    Driver.FindElementByXPath("//*[@id='username-:0-text']").SendKeys "xxxxxxx@gmail.com"
    ' パスワードを入力
    Driver.FindElementByXPath("//*[@id='password-:1-text']").SendKeys "xxxxxxx"
    ' ログインボタンを押す
    Driver.FindElementByXPath("//*[@id='login-form-outer']/form/div[4]/div[2]/input").Click
    ' サイボウズofficeをクリック
    Driver.FindElementByXPath("/html/body/div[5]/div/div[1]/div/a[2]").Click
    ' 在席ステータスをクリック
    Driver.FindElementByXPath("//*[@id='cb7-portlet-body-110']/form/table/tbody/tr/td/table/tbody/tr/td[2]/a").Click
    ' セレクトボックスを選択
    Driver.FindElementByXPath("//*[@id='content-wrapper']/div[4]/div/form/table/tbody/tr/td/table/tbody/tr[2]/td/div/div[1]/table[2]/tbody/tr[1]/td/select").AsSelect.SelectByText "席空き"
    ' 変更ボタンをクリック
    Driver.FindElementByXPath("//*[@id='content-wrapper']/div[4]/div/form/table/tbody/tr/td/table/tbody/tr[2]/td/div/div[2]/p/input[1]").Click
    Driver.Wait 3000
    ' トップページに戻る
    Driver.FindElementByXPath("//*[@id='appIconMenuFrame']/div[2]/span[1]/a").Click
    ' セルに在席ステータスを書き込む
    seatStatus = Driver.FindElementByXPath("//*[@id='cb7-portlet-body-110']/form/table/tbody/tr/td/table/tbody/tr/td[2]/a").Text
    Range("B3").Value = seatStatus
End Sub
shocci7
自動化していきたい
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away