0
0

More than 1 year has passed since last update.

selenium メモメモ 個人用3

Posted at
from selenium import webdriver
import chromedriver_binary
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import Select
import time 
import time_now
import yaml


driver_path = './chromedriver.exe'
driver = webdriver.Chrome(executable_path=driver_path)

#-------------------------------エラーメッセージを消す-------------------------------
ChromeOptions = webdriver.ChromeOptions()
ChromeOptions.add_experimental_option('excludeSwitches', ['enable-logging'])
#----------------------------------------------------------------------------------


# urlを指定してブラウザで開く
url = ''
driver.get(url)
time.sleep(1)

#入力操作
search=driver.find_element(By.ID,('twotabsearchtextbox'))
search.send_keys('バトスピ')
time.sleep(1)


#クリック操作
search_on=driver.find_element(By.ID,('nav-search-submit-button'))
search_on.click()
time.sleep(1)

# drop=driver.find_element(By.CLASS_NAME,('a-button-text a-declarative'))
# drop_select = Select(drop)
# drop_select.de('新着商品')
# time.sleep(2)

# drop=driver.find_element(By.ID,('a-autoid-0-announce'))
# drop.click()
# time.sleep(1)

#ドロップダウン操作
# drop=driver.find_element(By.NAME,('url'))
# select = Select(drop)
# select.select_by_value("search-alias=audible")
# time.sleep(5)

nowtime_str=time_now.dtnow()
result ="現時刻は" + nowtime_str
print(result)

with open('para.yaml') as file:
    obj = yaml.safe_load(file)
    print(obj['z'])












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