0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

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

Posted at

環境

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
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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?