Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
getPageSource now uses the same code as the java Xpath code. Happens …
…on the java side, not in node.
- Loading branch information
Showing
10 changed files
with
96 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 0 additions & 65 deletions
65
...evices/android/bootstrap/src/io/appium/android/bootstrap/handler/DumpWindowHierarchy.java
This file was deleted.
Oops, something went wrong.
47 changes: 47 additions & 0 deletions
47
lib/devices/android/bootstrap/src/io/appium/android/bootstrap/handler/Source.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package io.appium.android.bootstrap.handler; | ||
|
||
import io.appium.android.bootstrap.AndroidCommand; | ||
import io.appium.android.bootstrap.AndroidCommandResult; | ||
import io.appium.android.bootstrap.CommandHandler; | ||
import io.appium.android.bootstrap.utils.XMLHierarchy; | ||
import org.json.JSONException; | ||
import org.w3c.dom.Document; | ||
|
||
import javax.xml.transform.Transformer; | ||
import javax.xml.transform.TransformerConfigurationException; | ||
import javax.xml.transform.TransformerException; | ||
import javax.xml.transform.TransformerFactory; | ||
import javax.xml.transform.dom.DOMSource; | ||
import javax.xml.transform.stream.StreamResult; | ||
import java.io.StringWriter; | ||
|
||
/** | ||
* Get page source. Return as string of XML doc | ||
*/ | ||
public class Source extends CommandHandler { | ||
@Override | ||
public AndroidCommandResult execute(AndroidCommand command) throws JSONException { | ||
|
||
Document doc = (Document) XMLHierarchy.getFormattedXMLDoc(); | ||
|
||
TransformerFactory tf = TransformerFactory.newInstance(); | ||
StringWriter writer = new StringWriter(); | ||
Transformer transformer; | ||
String xmlString; | ||
|
||
|
||
try { | ||
transformer = tf.newTransformer(); | ||
transformer.transform(new DOMSource(doc), new StreamResult(writer)); | ||
xmlString = writer.getBuffer().toString(); | ||
|
||
} catch (TransformerConfigurationException e) { | ||
e.printStackTrace(); | ||
throw new RuntimeException("Something went terribly wrong while converting xml document to string"); | ||
} catch (TransformerException e) { | ||
return getErrorResult("Could not parse xml hierarchy to string: " + e.getMessage()); | ||
} | ||
|
||
return getSuccessResult(xmlString); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters