问题描述
我正在尝试使用 python 和 selenium 制作一个小的 Facebook 群组自动发布脚本
l = driver.find_elements_by_tag_name('input')
for g in l:
print(g)
try:
if g == driver.find_element_by_xpath("//input[@type='file']"):
print("Found")
logging.debug("Found input for image uploading")
g.send_keys(
'/var/www/html/v1/insta-post/AutopostFB/images/0.jpg \n/var/www/html/v1/insta-post/AutopostFB/images/1.jpg \n/var/www/html/v1/insta-post/AutopostFB/images/2.jpg')
print("File/s Uploaded")
logging.debug("Images uploaded")
time.sleep(5)
# break
except:
print("Element not found after upload")
logging.debug("Element for upload not found")
然后我推送帖子文本,因为文本框已经在焦点上
actions = ActionChains(driver)
actions.send_keys(info)
actions.perform()
time.sleep(1)
问题是 info 变量中的每个空格都异常转换为返回键
所以如果文字像
info = "HEI HOW'S IS GOING?"
我在文本框中得到的是
IS
GOING
hey
HOW'S
有人可以帮我吗?我什么都试过了
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)