I have a lambda function that is sent to another function, i want to change a variable that is declared outside of the lambda scope, in the lambda.
WebElement textArea ;
BrowserToucher.clickOnWebElement(() -> {
WebElement convPopupOrCard = findElementBy(driver,
conversationCardOrPopup);
return textArea = findSubElementBy(driver, convPopupOrCard,
CardAndPopupTextArea);
}, driver);
BrowserToucher.sendKeys(textArea, driver, text);
I need to change the 'textArea' var in the labmda, so i can use its value in the last line.
The only solution i've found is to make 'textArea' an array in size of 1. But I don't really understand why it works. Would love if anyone can explain that to me please. Thank you!!