Rohith1324
Board Regular
- Joined
- Feb 27, 2018
- Messages
- 114
Hi,
I have the below code but getting stuck on the code highlighted below : ( Red )
can someone pls suggest what is wrong here.
bot.Start "Chrome", "??"
bot.Window.Maximize
bot.Get "??"
bot.Wait 2000
bot.FindElementByXPath("//*[@id='unamebean']").SendKeys ActiveSheet.Range("B1").Value
bot.FindElementByXPath("//*[@id='pwdbean']").SendKeys ActiveSheet.Range("B3").Value
bot.FindElementByXPath("//*[@id='SubmitButton']").Click
bot.FindElementByXPath("//*[@id='AppsNavLink']").Click
bot.Timeouts.PageLoad = 90000
bot.FindElementByXPath("//*[@id='ILS_POS_PMENTS']").Click
bot.FindElementByXPath("//*[@id='ILS_POS_ASN_SELECT_TASK']").Click
bot.FindElementByLinkText("Create Advance Notices/Service Note").Click
bot.FindElementByXPath("//*[@id='AdvSearchBtn']").Click
For Each C In Range("A6:A" & Cells(Rows.Count, "A").End(xlUp).Row).Cells
bot.Timeouts.PageLoad = 90000
OName = C.Offset(0, 0).Value
Debug.Print OName
DoEvents
bot.Wait 500
bot.FindElementByXPath("//*[@id='Value_0']").SendKeys C.Offset(0, 0).Value
bot.Wait 200
bot.FindElementByXPath("//*[@id='AdvSearch']/table[3]/tbody/tr[9]/td[4]/button[1]").Click
Set np = bot.FindElementByXPath("//*[@id='STable']/table/tbody/tr/td/table/tbody/tr[2]/td[2]")
C.Offset(0, 42).Value = np.Text
If IsEmpty(C.Offset(0, 43).Value) = True Then
C.Offset(0, 44).Value = "Can not be processed"
Next C ‘Getting stuck here
Else
C.Offset(0, 44).Value = "Processing"
End If
R = 1
Set rsecs = bot.FindElementsByClass("xaq")
For Each rsec In rsecs
R = R + 1
Sheets("Sheet2").Cells(R, 2).Value = rsec.Text
Next rsec
bot.FindElementByXPath("//*[@id='PosAsnAddToCart']").Click
bot.FindElementByXPath("//*[@id='N317:AddAttach:0']/a/img").Click
bot.FindElementByXPath("//*[@id='FileName']").SendKeys C.Offset(0, 1).Value
bot.FindElementByXPath("//*[@id='FileInput_oafileUpload']").SendKeys C.Offset(0, 2).Value
bot.FindElementByXPath("//*[@id='Okay_uixr']").Click
Next C
MsgBox "Macro is done till this level, your inputs requried to proceed further"
End Sub
I have the below code but getting stuck on the code highlighted below : ( Red )
can someone pls suggest what is wrong here.
bot.Start "Chrome", "??"
bot.Window.Maximize
bot.Get "??"
bot.Wait 2000
bot.FindElementByXPath("//*[@id='unamebean']").SendKeys ActiveSheet.Range("B1").Value
bot.FindElementByXPath("//*[@id='pwdbean']").SendKeys ActiveSheet.Range("B3").Value
bot.FindElementByXPath("//*[@id='SubmitButton']").Click
bot.FindElementByXPath("//*[@id='AppsNavLink']").Click
bot.Timeouts.PageLoad = 90000
bot.FindElementByXPath("//*[@id='ILS_POS_PMENTS']").Click
bot.FindElementByXPath("//*[@id='ILS_POS_ASN_SELECT_TASK']").Click
bot.FindElementByLinkText("Create Advance Notices/Service Note").Click
bot.FindElementByXPath("//*[@id='AdvSearchBtn']").Click
For Each C In Range("A6:A" & Cells(Rows.Count, "A").End(xlUp).Row).Cells
bot.Timeouts.PageLoad = 90000
OName = C.Offset(0, 0).Value
Debug.Print OName
DoEvents
bot.Wait 500
bot.FindElementByXPath("//*[@id='Value_0']").SendKeys C.Offset(0, 0).Value
bot.Wait 200
bot.FindElementByXPath("//*[@id='AdvSearch']/table[3]/tbody/tr[9]/td[4]/button[1]").Click
Set np = bot.FindElementByXPath("//*[@id='STable']/table/tbody/tr/td/table/tbody/tr[2]/td[2]")
C.Offset(0, 42).Value = np.Text
If IsEmpty(C.Offset(0, 43).Value) = True Then
C.Offset(0, 44).Value = "Can not be processed"
Next C ‘Getting stuck here
Else
C.Offset(0, 44).Value = "Processing"
End If
R = 1
Set rsecs = bot.FindElementsByClass("xaq")
For Each rsec In rsecs
R = R + 1
Sheets("Sheet2").Cells(R, 2).Value = rsec.Text
Next rsec
bot.FindElementByXPath("//*[@id='PosAsnAddToCart']").Click
bot.FindElementByXPath("//*[@id='N317:AddAttach:0']/a/img").Click
bot.FindElementByXPath("//*[@id='FileName']").SendKeys C.Offset(0, 1).Value
bot.FindElementByXPath("//*[@id='FileInput_oafileUpload']").SendKeys C.Offset(0, 2).Value
bot.FindElementByXPath("//*[@id='Okay_uixr']").Click
Next C
MsgBox "Macro is done till this level, your inputs requried to proceed further"
End Sub