shrw
shrw

Reputation: 1801

Xcode debugging javascript of a webview in Swift

Is it possible to debug a Javascript code(of webview) from Xcode/Swift debug. Using version xcode 12.

Similar to chrome inspect debugging in webview.

Upvotes: 0

Views: 333

Answers (1)

zeytin
zeytin

Reputation: 5643

Yes it is possible. Furthermore you can even write a test for it. Suppose that you have a Webview which in textbox written by javascript codes then you need to find location of items with coordinates. Finally you can test it like this;

let textFieldVector = CGVector(dx: 247, dy: 436)
let textFieldCoordinate = app.coordinate(withNormalizedOffset: .zero).withOffset(textFieldVector)
textFieldCoordinate.tap()
app.typeText("your Login username")

Also my medium article can be useful if you proceed test cases for Webviews . Link is here.

Upvotes: 1

Related Questions