SetVariableByNodeAttributeAction extends SymbolAction { public String getAttribute() { return attribute; }  String getName(); void setName(String name); WebElementLocator getNode(); void setNode(WebElementLocator node); String getAttribute(); void setAttribute(String attribute);  }
@Test public void shouldSetTheVariableIfTheNodeAndAttributeExists() { ConnectorManager connector = mock(ConnectorManager.class); VariableStoreConnector variables = mock(VariableStoreConnector.class); given(connector.getConnector(VariableStoreConnector.class)).willReturn(variables); WebElement element = mock(WebElement.class); given(element.getAttribute(ATTRIBUTE_NAME)).willReturn(ATTRIBUTE_VALUE); WebSiteConnector webSiteConnector = mock(WebSiteConnector.class); given(webSiteConnector.getElement(node)).willReturn(element); given(connector.getConnector(WebSiteConnector.class)).willReturn(webSiteConnector); ExecuteResult result = setAction.executeAction(connector); assertTrue(result.isSuccess()); verify(variables).set(VARIABLE, ATTRIBUTE_VALUE); }