0

In the following code I am trying to navigate to use the web application "WhatsApp"

Private bot As New Selenium.ChromeDriver

Sub Test()
Dim arr(), ws As Worksheet, i As Long

Const NO_JS_PROFILE As String = "C:\Users\Future\AppData\Local\Google\Chrome\User Data\Profile 1"
Const JS_PROFILE As String = "C:\Users\Future\AppData\Local\Google\Chrome\User Data\Default"

Set bot = New ChromeDriver
Set ws = ActiveSheet
arr = Application.Transpose(ws.Range("A2:A" & ws.Cells(Rows.Count, 1).End(xlUp).Row))

With bot
    .SetProfile JS_PROFILE, True
    .Get "https://web.whatsapp.com/send?phone=" & arr(1)

The code works fine till this point .. At the last line after it I need a way to make the code waits till the application is completely loaded instead of using Application.Wait method ..

braX
  • 11,506
  • 5
  • 20
  • 33
YasserKhalil
  • 9,138
  • 7
  • 36
  • 95
  • How would you expect that to work exactly? One way might be to use a loop to wait until a specific element is rendered on the page - have you considered that approach? – Tim Williams Dec 19 '19 at 20:50
  • Yes I have used this trick before but doesn't work well for the web application .. sometimes work and sometimes throw an error .. so not stable – YasserKhalil Dec 19 '19 at 21:15
  • If it throws an error then you can catch the error and proceed... – Tim Williams Dec 19 '19 at 23:25
  • I don't know what do you mean by catch the error and proceed ..!? – YasserKhalil Dec 19 '19 at 23:51
  • I mean like https://stackoverflow.com/questions/37956889/selenium-webdriver-vba-explicit-wait I guess it would help your question if you showed the code you tried and described exactly what the problem was that you had when you tried that approach. If it's not working with Selenium then you could maybe try IE instead. – Tim Williams Dec 20 '19 at 00:22
  • Thanks a lot for great help. I tried QHarr's code in the link you posted and worked fine for me. – YasserKhalil Dec 20 '19 at 06:24
  • 1
    Good to hear you got it working. – Tim Williams Dec 20 '19 at 07:47

0 Answers0