alleyway / add-tradingview-alerts-tool

Automated entry of TradingView alerts for bot trading tools such as 3Commas, Alertatron, CryptoHopper, etc.
MIT License
636 stars 141 forks source link

ERROR waiting for XPath //div[@id="header-toolbar-symbol-search"] failed: timeout 20000ms exceeded #66

Closed avatar-lavventura closed 3 years ago

avatar-lavventura commented 3 years ago

I am having ERROR waiting for XPath //div[@id="header-toolbar-symbol-search"] failed: timeout 20000ms exceeded error, not sure what may be the main cause of it. How can I resolve this problem?

Error I am having:

$ ./atat add-alerts --loglevel 5 --delay 1000
ℹ ATAT Version: 1.8.6 | Node Version: v16.3.0                                                                                                    15:29:44
ℹ Current log level: 5 (you can specify '--loglevel 5' for maximum debugging)                                                                    15:29:44
ℹ Base delay: 1000 (you can specify '--delay 1000' (or env variable BASE_DELAY) to increase/decrease speed)                                      15:29:44
ℹ Using config file:  config.yml                                                                                                                 15:29:44
ℹ Press Ctrl-C to stop this script                                                                                                               15:29:44
› Reading input file: binance_usdt_pairs.csv                                                                                                     15:29:44
› ...waiting 5000ms = 5 x 1000  let page load and see if access is denied                                                                        15:29:45
› ...waiting 3000ms = 3 x 1000  wait a little longer for page to load                                                                            15:29:50
› minimizing footer chart panel                                                                                                                  15:29:53
› ...selector: //div[@id='footer-chart-panel']//button[@data-name='toggle-visibility-button' and @data-active='false']                           15:29:53
› no minimize button found, footer chart panel must be hidden already                                                                            15:29:58
› set interval: 15m                                                                                                                              15:29:58
› ...waiting 500ms = 0.5 x 1000  after pressing interval shortcut key                                                                            15:29:58
› ...waiting 3000ms = 3 x 1000  after changing the interval                                                                                      15:29:58
ℹ Adding symbol: BINANCE:NEOUSDT  ( NEO priced in USDT )                                                                                         15:30:01
› ...waiting 2000ms = 2 x 1000  let things settle from processing last alert                                                                     15:30:01
› ...selector: //div[@id="header-toolbar-symbol-search"]                                                                                         15:30:03

 ERROR  waiting for XPath //div[@id="header-toolbar-symbol-search"] failed: timeout 20000ms exceeded                                             15:30:23

  at new WaitTask (node_modules/puppeteer/src/common/DOMWorld.ts:780:28)
  at DOMWorld.waitForXPath (node_modules/puppeteer/src/common/DOMWorld.ts:675:22)
  at Frame.waitForXPath (node_modules/puppeteer/src/common/FrameManager.ts:1193:47)
  at Page.waitForXPath (node_modules/puppeteer/src/common/Page.ts:2111:29)
  at fetchFirstXPath (node_modules/@alleyway/add-tradingview-alerts-tool/src/service/tv-page-actions.ts:15:20)
  at navigateToSymbol (node_modules/@alleyway/add-tradingview-alerts-tool/src/service/tv-page-actions.ts:154:37)
  at addAlertsMain (node_modules/@alleyway/add-tradingview-alerts-tool/src/add-alerts.ts:181:15)
  at Command.<anonymous> (node_modules/@alleyway/add-tradingview-alerts-tool/src/cli.ts:77:13)

Example config file:

files:
  input: binance_usdt_pairs.csv
  exclude: blacklist.csv
tradingview:
  chartUrl: https://www.tradingview.com/script/Jdw7wW2g-Technical-Ratings/
  interval: 15m
alert:
  condition:
    primaryLeft: RSI
    primaryRight:
    secondary: Moving Up
    tertiaryLeft: 3.4
    tertiaryRight: 14
    quaternaryLeft:
    quaternaryRight:
  option: Once Per Bar Close
  actions:
    notifyOnApp: false
    showPopup: false
    sendEmail: false
    webhook:
      enabled: true
      url: "https://3commas.io/trade_signal/trading_view"
  message: >
    {
         "message_type": "bot",
         "bot_id": 999999,
         "email_token": "fffffff-fffff-fffff-ffff-ffffffffff",
         "delay_seconds": 0,
         "pair": "{{quote}}_{{base}}"
    }
avatar-lavventura commented 3 years ago

I had to manually add the strategy into chart before adding operation starts. Into add-alerts.js file I have add await sleep(20000); right before if (accessDenied) { to solve.

Sleep function:

function sleep(ms) {
  return new Promise((resolve) => {
    setTimeout(resolve, ms);
  });
}