简体   繁体   English

如何使用 selenium python send_keys 将表格 dataframe 发送到网页的文本区域?

[英]How to send tabulated dataframe to text area of webpage using selenium python send_keys?

So i'm able to print the tabulated dataframe in my console and now i want to send the same tabulated dataframe in an text area of webpage.所以我可以在我的控制台中打印表格 dataframe,现在我想在网页的文本区域中发送相同的表格 dataframe。 Below is my code where excel_data_df1 read the excel file as pandas, and i'm using python 3.8.下面是我的代码,其中 excel_data_df1 将 excel 文件读取为 pandas,我使用的是 python 3.8。 Attached the screenshots for reference.附上截图供参考。

SelectUp = excel_data_df1[(excel_data_df1['Marketplace'] == 'US') & (excel_data_df1['Product Line'] == 'Books')]
Guideline = print(tabulate(SelectUp, headers='keys', tablefmt='psql',showindex=False))
driver.find_element_by_id('tab_work_log').click()
WL = driver.find_element_by_id('work_log')
WL.send_keys(Guideline)

Tabulated dataframe in console screenshot Error screenshot控制台截图中的表格 dataframe错误截图

AFAIK print() method doesn't return actual value ie it returns nothing. AFAIK print()方法不返回实际值,即它什么也不返回。
This actually causes Guideline to become None type object.这实际上导致Guideline变为None类型 object。
That's why这就是为什么

WL.send_keys(Guideline)

actually实际上

WL.send_keys(None)

throws that error抛出该错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM