i'm trying send post request chrome
extension dhc
https://chrome.google.com/webstore/detail/dhc-resthttp-api-client/aejoelaoggembcahagimdiliamlcdmfm?hl=en (i know there lot of tools send http
requests, need use one). wrote following code:
from selenium.webdriver.chrome.options import options selenium import webdriver # add option able use dhc extension chrome_options = options() chrome_options.add_extension('/usr/lib/firefox/browser/extensions/aejoelaoggembcahagimdiliamlcdmfm-0.8.6.2-www.crx4chrome.com.crx') # start browser session dr = webdriver.chrome(chrome_options=chrome_options) # open extension page dr.get('chrome-extension://aejoelaoggembcahagimdiliamlcdmfm/dhc.html') # close update pop-up if exists try: dr.find_element_by_xpath('//a[@class="btn btn-info"]').click() except: pass # change http request type post request_type = dr.find_elements_by_xpath('//input[@class="gwt-textbox"]')[1] request_type.clear() request_type.send_keys("post") # choose body type 'file' dr.find_element_by_xpath('//div[@class="pane-head"]').click() dr.find_elements_by_xpath('//li[@class="dropdown right"]')[1].click() dr.find_element_by_xpath('//a[contains(text(), "file")]').click() # set path file want send dr.find_element_by_xpath('//input[@class="gwt-fileupload"]').send_keys('/path/to/file/dummy3gb')
after last step name of uploaded file appears, actual file size 0 bytes , can't send request content not recognized while if choose file manually upload prompt proper file size displayed , can send request
am doing wrong? ideas?
when want test api dhc post method. there has option input type first 1 test , second 1 file. according image.
when select file drop down can post file web service.
Comments
Post a Comment