Issue
I am trying to select a date but currently struggling. This date selector is in a iframe. I have switched to iframe but no nothing works to select the date, I have trying to change the data in this value part but it still does not work. I used the CSS, Xpath, ID, Class but nothing works.
.
I have found that using the Xpath is work for all the other elements like selecting time and dropdown.
With obj 'open edge .Start "edge" End With
'declare URL
Dim url As String
url = "http://cogprodweb.co.za"
'nagivate to url
obj.Get (url)
With obj
'Wait for frame to load and then Select the iframe
Application.Wait (Now + TimeValue("0:00:02"))
.SwitchToFrame ("iC93CD3A10B5343779D27E431CE7AF966")
'Select Locations
.FindElementByXPath("/html/body/form[1]/table/tbody/tr[2]/td/div/div/table/tbody/tr[2]/td/div[2]/table/tbody/tr/td[2]/div/select/option[9]", 3000).click
'Select Date
.FindElementByXPath("/html/body/form[1]/table/tbody/tr[2]/td/div/div/table/tbody/tr[2]/td/table/tbody/tr[3]/td[1]/div/table/tbody/tr/td/table/tbody/tr/td/table/tbody/tr/td[1]/input", 3000).SendKeys("2021-07-19").click
I through identifying the calendar (which is table) and them running from the cells until it equal to inputted value (yesterday). I am not sure what do you for that. The variables, I have been looking at has not been working out. Looking at this to.
Iterating Through Table Rows in Selenium (Python)
Solution
it looks like the id of the iframe is being regenerated and the locator you're using might be no good i.e: .SwitchToFrame ("iC93CD3A10B5343779D27E431CE7AF966")
either use a solid locator (add an id to the iframe element in html) or use a different locator meanwhile.
you can debug this and try to grab the iframe element with the id that was generated and see if indeed it's the locator issue or not
Answered By - Yulian Amstislavski
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.