Hi, I am trying to simulate a bunch of stock market purchases using past data using Google Finance. The criteria and everything works properly until I try and select transaction type from the dropdown in my portfolio. The options are "buy", "sell", "buy to cover", and "sell short". I have used sendkeys after clicking on the box to switch to "sell" but once I submit the order, it always processes it as "buy". So basically, what is going on now is I buy when my criteria says to buy and buy when my criteria says to sell. I want to simulate this stockmarket automation on google finance before switching to a real online stock service to verify my criteria works. Any help would be great. Thanks,
'I sign in using my email and password
driver.Click "id=signIn"
driver.findElementByXPath("//html/body/div[@class='fjfe-bodywrapper']/div[@id='fjfe-real-body']/div[@id='fjfe-click-wrapper']/div[@class='elastic']/div[@id='app']/div[@id='gf-viewc']/div[@class='fjfe-content']/div[@class='g-floatfix']/div[@class='sfe-break-top sfe-break-bottom']/div[@id='pf-add-trans-bar']/div[@class='add_trans_bar_border']/form[@id='addtransform']/div[@id='aform']/div[@class='pf-add-trans-row']/div[@class='g-section g-tpl-350']/div[@class='g-unit gf-control']/div[@id='pf-add-trans-toggle-btn']/span[@class='linkbtn']").Click
'clicks on add transaction
driver.findElementByXPath("//html/body/div[@class='fjfe-bodywrapper']/div[@id='fjfe-real-body']/div[@id='fjfe-click-wrapper']/div[@class='elastic']/div[@id='app']/div[@id='gf-viewc']/div[@class='fjfe-content']/div[@class='g-floatfix']/div[@class='sfe-break-top sfe-break-bottom']/div[@id='pf-add-trans-bar']/div[@class='add_trans_bar_border']/form[@id='addtransform']/div[@id='aform']/div[@id='add-trans-t']/div[@class='pf-add-trans-row pf-add-trans-detailed'][1]/table[@id='pf-add-trans-table']/tbody/tr/td[1]/select[@id='add_ttype']").Click
'clicks on transaction box
driver.findElementByXPath("//html/body/div[@class='fjfe-bodywrapper']/div[@id='fjfe-real-body']/div[@id='fjfe-click-wrapper']/div[@class='elastic']/div[@id='app']/div[@id='gf-viewc']/div[@class='fjfe-content']/div[@class='g-floatfix']/div[@class='sfe-break-top sfe-break-bottom']/div[@id='pf-add-trans-bar']/div[@class='add_trans_bar_border']/form[@id='addtransform']/div[@id='aform']/div[@id='add-trans-t']/div[@class='pf-add-trans-row pf-add-trans-detailed'][1]/table[@id='pf-add-trans-table']/tbody/tr/td[1]/select[@id='add_ttype']").SendKeys ("Sell")
'enters "sell" into transactiontype box
driver.findElementByXPath("//html/body/div[@class='fjfe-bodywrapper']/div[@id='fjfe-real-body']/div[@id='fjfe-click-wrapper']/div[@class='elastic']/div[@id='app']/div[@id='gf-viewc']/div[@class='fjfe-content']/div[@class='g-floatfix']/div[@class='sfe-break-top sfe-break-bottom']/div[@id='pf-add-trans-bar']/div[@class='add_trans_bar_border']/form[@id='addtransform']/div[@id='aform']/div[@id='add-trans-t']/div[@class='pf-add-trans-row pf-add-trans-detailed'][1]/table[@id='pf-add-trans-table']/tbody/tr/td[1]/select[@id='add_ttype']").SendKeys ("{ENTER}")
'hits enter
driver.findElementByXPath("//html/body/div[@class='fjfe-bodywrapper']/div[@id='fjfe-real-body']/div[@id='fjfe-click-wrapper']/div[@class='elastic']/div[@id='app']/div[@id='gf-viewc']/div[@class='fjfe-content']/div[@class='g-floatfix']/div[@class='sfe-break-top sfe-break-bottom']/div[@id='pf-add-trans-bar']/div[@class='add_trans_bar_border']/form[@id='addtransform']/div[@id='aform']/div[@id='add-trans-t']/div[@class='pf-add-trans-row pf-add-trans-detailed'][1]/table[@id='pf-add-trans-table']/tbody/tr/td[1]/select[@id='add_ttype']").Click
'clicks on box again
'some other stuff that I tried:
'driver.typeKeys "id=add_ttype", "Sell"
'driver.Click ("name=add_ttype_1")
'driver.Select "id=add_ttype", "Sell"
driver.Type "id=add_date", purchasedate
'types in date of transaction
driver.Type "id=add_shares", nunmberofshares
'types in number of shares
driver.Type "id=add_price", stockprice
'types in price at time of transaction
driver.Type "id=add_commission", commissionfee
'types in the commission cost
driver.Type "id=add_symbols", stocksymbol
'types in symbol
driver.findElementByXPath("//html/body/div[@class='fjfe-bodywrapper']/div[@id='fjfe-real-body']/div[@id='fjfe-click-wrapper']/div[@class='elastic']/div[@id='app']/div[@id='gf-viewc']/div[@class='fjfe-content']/div[@class='g-floatfix']/div[@class='sfe-break-top sfe-break-bottom']/div[@id='pf-add-trans-bar']/div[@class='add_trans_bar_border']/form[@id='addtransform']/div[@id='aform']/div[@class='pf-add-trans-row']/div[@class='g-section g-tpl-350']/div[@class='g-unit gf-control']/div[@id='pf-add-trans-toggle-btn']/span[@class='linkbtn']").Click
'clicks on add transaction again
driver.findElementByXPath("//html/body/div[@class='fjfe-bodywrapper']/div[@id='fjfe-real-body']/div[@id='fjfe-click-wrapper']/div[@class='elastic']/div[@id='app']/div[@id='gf-viewc']/div[@class='fjfe-content']/div[@class='g-floatfix']/div[@class='sfe-break-top sfe-break-bottom']/div[@id='pf-add-trans-bar']/div[@class='add_trans_bar_border']/form[@id='addtransform']/div[@id='aform']/div[@class='pf-add-trans-row']/div[@class='g-section g-tpl-350']/div[@class='g-unit g-first gf-control']/input[@id='addstock']").Click
'adds to portfolio
Bookmarks