Hey, this is an English text. I want you to translate it into the Tunisian dialect.…
- User
Hey, this is an English text. I want you to translate it into the Tunisian dialect. Please follow these steps:
- Translate step by step and highlight differences between Tunisian dialect and Modern Standard Arabic.
- Highlight sections you are confident translating into the Tunisian dialect. Translate this text into the Tunisian dialect, focusing on capturing the essence of the language nuances:
Q: Selenium made a sendKeys for two fields instead of one for some reason I made a pretty simple selenium test, where I want to open web page, clear field value, start entering text for this field, select first value from the hint drop down. Web site is aviasales.com (I just found some site with a lot of controls, this is not an advertisement) I did DriverFactory.getDriver().findElement(By.id("flights-origin-prepop-whitelabel_en")).clear(); and it was working perfectly, I also checked via console that this is the only one object on a page like: document.getElementById('flights-origin-prepop-whitelabel_en') So, in next line I'm sending value: DriverFactory.getDriver().findElement(By.id("flights-origin-prepop-whitelabel_en")).sendKeys("LAX"); but it send LAX value for both "flights-origin-prepop-whitelabel_en" and "flights-destination-prepop-whitelabel_en" for some reason, then i tried DriverFactory.getDriver().findElement(By.id("//input[@id='flights-destination-prepop-whitelabel_en'][@placeholder='Destination']")).sendKeys(destinationAirport); but I got the same result: What could be a reason and how to fix this? Thank you! A: Yep... there's some weird behavior going on there. The site is copying whatever is entered into the first field into the second for reason I don't understand. I gave up trying to understand it and found a way around it. Whenever I write code that I know I'm going to reuse, I put them into functions. Here's the script code driver.navigate().to(url); setOrigin("LAX"); setDestination("DFW"); ...and since you are likely to use these repeatedly, the support functions. public static void setOrigin(String origin) { WebElement e = driver.findElement(By.id("flights-origin-prepop-whitelabel_en")); e.click(); e.clear(); e.sendKeys(origin); e.sendKeys(Keys.TAB); } public static void setDestination(String dest) { WebElement e = driver.findElement(By.id("flights-destination-prepop-whitelabel_en")); e.click(); e.clear(); e.sendKeys(dest); e.sendKeys(Keys.TAB); } You can see the functions but basically I click in the field, clear the text (because usually there's something already in there), send the text, and then press to move out of the field and choose the default (first choice).
- Assistant