如何使用python在Webbot中获得$ 0的值

问题描述 投票:0回答:1

[请在下面的代码中尝试获取网站中的卖方收益值,但当我在控制台$ 0中尝试时它具有$ 0.value时获得598.08但当我尝试使用此 sel_proc = web.find_elements(id="afn-seller-proceeds")[0].text时却获得了[[Calculate'''完整代码:

import pandas as pd from webbot import Browser from bs4 import BeautifulSoup web = Browser() ##web.set_window_position(-10000,0) df = pd.read_excel('sample.xlsx') soafees = [] fulfees = [] selproc = [] for ind in df.index: web.go_to('https://somelink') ## web.set_window_position(-10000,0) web.click(id='link_continue') print("Login Successful") asin = df['ASIN'][ind] sp = int(df['Selling Price'][ind]) print(sp) cp = int(df['Cost of Product'][ind]) print(cp) web.type(df['ASIN'][ind] , into = 'Enter your product name, UPC, EAN, ISBN or ASIN',clear = True) web.click(id='a-autoid-0') web.type(sp,tag='input',id='afn-pricing',clear = True) web.type(cp,tag='input',id='afn-cost-of-goods',clear = True) web.click(id='update-fees-link') res = web.find_elements(id="afn-selling-fees")[0].text ful_fees = web.find_elements(id="afn-amazon-fulfillment-fees")[0].text sel_proc = web.find_elements(id="afn-seller-proceeds")[0].text ## sel_proc = web.execute_script('return arguments[0].value;', element); print("soa fees : "+res) print("Fulfillment fees : "+ful_fees) print("Seller Proceeds : "+sel_proc) soafees.append(res) fulfees.append(ful_fees) selproc.append(sel_proc) print(soafees) print(fulfees) print(selproc) df_soa = pd.DataFrame(soafees,columns = ['SOA Fees']) df_ful = pd.DataFrame(fulfees,columns = ['FBA Fees']) df_sel = pd.DataFrame(selproc,columns = ['Seller Proceeds']) print(df) print(df_soa) print(df_ful) print(df_sel)
快照供参考:enter image description here

感谢您的支持

python pandas dataframe python-3.4 webbot
1个回答
0
投票
在sel_proc变量中,您正在存储文本,而是应查找具有该值的属性。我认为,在这种情况下,它应该是“值”属性。
© www.soinside.com 2019 - 2024. All rights reserved.