I am trying to scrape this website. I got a problem with text fields because text fields and drop-down menus combined. The site does not allow to enter the names of cities directly. For example, I only want to take the port pointers (ex: Port of Shanghai, China), firstly, I must enter “Shanghai, China”, and need to click the first option, then need to click “Port of Shanghai, China”. (actually, ports are the second option). With the following codes, I can select the country name but not the port.
> remote_driver$findElement(using = ‘id’, value =’from’)$sendKeysToElement(list(“Shanghai, China”))$clickElement()
> remote_driver$findElement(using = “css”, value = “#from-autocomplete > div > div > div > div:nth-child(1)”)$clickElement()
> remote_driver$findElement(using = “css”, value = “#from-autocomplete > div > div > div > div.fvlk5rSgKI–Xo4zMn3an > div:nth-child(2)”)$clickElement()
But in the second selection for port names (3rd line), the port name has been erased from the text field.
Thanks in advance!
Source: Read More