/// <summary> /// This changes/pins the java script variable name <see cref="ElementReference"/> which is used to /// execute commands on FireFox. /// </summary> public void Pin() { var elementVariableName = ClientPort.CreateVariableName(); ClientPort.Write("{0}={1};", elementVariableName, ElementReference); ElementReference = elementVariableName; }
/// <summary> /// Gets the element by property. /// </summary> /// <param name="propertyName">Name of the property.</param> /// <returns>Returns the element that is returned by the specified property</returns> public JSElement GetElementByProperty(string propertyName) { if (string.IsNullOrEmpty(propertyName)) { throw new ArgumentNullException("propertyName"); } var elementvar = ClientPort.CreateVariableName(); var command = string.Format("{0}={1}.{2}; {0}!=null;", elementvar, ElementReference, propertyName); var exists = ClientPort.WriteAndReadAsBool(command); return(exists ? new JSElement(ClientPort, elementvar) : null); }