Handling frames selenium VBA

adinev

New Member
Joined
Nov 10, 2022
Messages
12
Office Version
  1. 365
Platform
  1. Windows
Hi guys i am trying to click an element in a frame but i cannot switch to the said frame. I tried everything but i get either :there is no such element or no such frame error.HTML below

VBA Code:
Option Explicit
Public Sub test()

Dim pause1, pause2, pause3, url, url2 As String
 
 pause1 = "00:00:08"
 
 pause2 = "00:00:30"
 
 pause3 = "00:00:40"

 url = "http://tra01:1000/"
 
 url2 = "https://TDMLogon.jsp"

Dim driver As New WebDriver

Dim rowc, cc, columnC As Integer


 
 
Dim tblent As Variant

Dim By As selenium.By

Set By = New selenium.By
driver.Start "Chrome"

driver.Get (url2)

Application.Wait Now + TimeValue(pause3)

driver.FindElementByXPath("/html/body/table[2]/tbody/tr/td/table[1]/tbody/tr/td/form/table/tbody/tr[2]/td/table/tbody/tr[1]/td[2]/select").AsSelect.SelectByText ("EMP ID")

driver.FindElementByXPath("/html/body/table[2]/tbody/tr/td/table[1]/tbody/tr/td/form/table/tbody/tr[2]/td/table/tbody/tr[2]/td[2]/select").AsSelect.SelectByText ("English")

driver.FindElementByXPath("/html/body/table[2]/tbody/tr/td/table[1]/tbody/tr/td/form/table/tbody/tr[2]/td/table/tbody/tr[4]/td/input").Click

Application.Wait Now + TimeValue(pause1)

driver.SwitchToParentFrame


driver.SwitchToFrame driver.FindElementByXPath("//*[@id=""frameset2""]")

Application.Wait Now + TimeValue(pause1)



driver.FindElementByXPath("//*[@id=""homeSearch""]").Click



End Sub
 

Attachments

  • html.PNG
    html.PNG
    77.9 KB · Views: 29

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top