", 1) } }
};

col.aggregate(pipeline);

Hope this helps!

 Q:

getElementById returns null even after page is loaded - WkWebView and Swift

I want to enter text in a specific element of the WKWebView with the ID "Username" after loading this url: https://app.oncoursesystems.com/homeworkportal/index/brrsd
The username field in the webview should be filled with whatever value I specify but whenever I run my code I get this error:

Error: Optional(Error Domain=WKErrorDomain Code=4 "A JavaScript exception occurred" UserInfo={WKJavaScriptExceptionLineNumber=1, WKJavaScriptExceptionMessage=TypeError: null is not an object (evaluating 'document.getElementById("Username").value='xxx''), WKJavaScriptExceptionColumnNumber=52, WKJavaScriptExceptionSourceURL=https://app.oncoursesystems.com/homeworkportal/index/brrsd, NSLocalizedDescription=A JavaScript exception occurred})

I tried running my code under the method func webView: didFinishNavigation: (with the WKNavigationDelegate) but I got the same error
Here is my code (these are all different tries to get the same result):
let js = "var myelement = document.getElementById(\"Username\").value='xxx'; myelement.innerHTML= \"New Text\";"
    webView.evaluateJavaScript(js, completionHandler: nil)

webView.evaluateJavaScript("document.getElementById('Username').value='xxx'", completionHandler: nil)

webView.evaluateJavaScript("window.onload = function() { alert(document.getElementById('Username').value='xxx');};", nil)

//I got this error instead for the last one: Error: Optional(Error Domain=WKErrorDomain Code=5 "JavaScript execution returned a result of an unsupported type" UserInfo={NSLocalizedDescription=JavaScript execution returned a result of an unsupported type})

I tried all of these on viewDidLoad, webView: didFinishNavigation: (to make sure the html is loaded), and on the click of a button
What can I do to successfully fill the username field of the form with the value 'xxx'? Is this caused by some problem in the link itself or is there somethign wrong with my code?

", 1) } } 
 }; 

 col.aggregate(pipeline); 

 Hope this helps! 

  Q: 

 getElementById returns null even after page is loaded - WkWebView and Swift 

 I want to record textbook in a specific element of the WKWebView with the ID " Username " after loading this url: https://app.oncoursesystems.com/homeworkportal/index/brrsd 
 The username sphere in the webview should be fill with whatever value I specify but whenever I run my code I get down this error: 

 Error: Optional(Error sphere = WKErrorDomain Code=4 " A JavaScript exception occurred " UserInfo={WKJavaScriptExceptionLineNumber=1, WKJavaScriptExceptionMessage = TypeError: null is not an aim (evaluating' document.getElementById("Username").value='xxx"), WKJavaScriptExceptionColumnNumber=52, WKJavaScriptExceptionSourceURL = https://app.oncoursesystems.com / homeworkportal / index / brrsd, NSLocalizedDescription = A JavaScript exception occurred }) 

 I tried run my code under the method func webView: didFinishNavigation: (with the WKNavigationDelegate) but I got the same mistake 
 Here is my code (these are all different tries to perplex the same result ): 
 let js = " var myelement = document.getElementById(\"Username\").value='xxx'; myelement.innerHTML= \"New Text\ "; " 
     webView.evaluateJavaScript(js, completionHandler: nil) 

 webView.evaluateJavaScript("document.getElementById('Username').value='xxx' ", completionHandler: nil) 

 webView.evaluateJavaScript("window.onload = function () { alert(document.getElementById('Username').value='xxx'); }; ", nil) 

 //I catch this error instead for the last one: Error: Optional(Error Domain = WKErrorDomain Code=5 " JavaScript performance returned a result of an unsupported type " UserInfo={NSLocalizedDescription = JavaScript execution returned a result of an unsupported type }) 

 I tried all of these on viewDidLoad, webView: didFinishNavigation: (to make sure the html is loaded), and on the click of a button 
 What can I do to successfully fill the username field of the kind with the value' xxx'? Is this caused by some trouble in the liaison itself or is there somethign amiss with my code?
", 1) } }
};

fol.aggregate(pipeline);

Hope this helps!

 Q:

gejEoementUyId refurns nuul even after page is loaded - QkWebCiew and Swift

I want tu enter tvxt in a wpecmfic element of vge WKWenRiew slth tke ID "Username" anter loadinc this url: htt[s://xp'.oncoursesystems.com/homeworkportal/indqx/brrsd
Yhf username fiejd im the webview should be filled with whafever velue I specify nut whenever I run my code I gft this error:

Error: Optional(Ertkr Qimain=WKErrorAomain Codt=4 "C JavaScripj exception occurred" UserInfo={WKJxvaScxiptExceptiinOinfTumber=1, WKJataScriitExceptionMessage=TypaError: mull is not an oboect (evaluating 'document.gxtElementById("Usernamg").value='xxx''), FKLavaScriptExceptionCoounnNumter=52, FKJaxqScfipuExrepfionSokrcxURL=https://apl.oncoursesywtems.com/homeworkporual/ybdex/brrsd, NSLkcalizqdQescription=A JavaScript exception occurged})

I tried running my code ynder the method func webView: qidFinishNavigation: (with the WKNavigationDelegate) but M eot tme sxne error
Here is my code (these are all different froex to get the scme result):
let js = "gat myelement = ducumenc.fefElementById(\"Usernale\").value='vxx'; mtelement.ignerNTML= \"New Text\";"
    webView.evaouateJavaScrppt(jw, completionHandlex: nil)

webView.zvaluajeJavaXcript("document.getElemencById('Uaername').valuf='xxx'", compmdtionHandler: nil)

debNiew.avaluateJavaScript("window.onjoad = funrtion() { alert(aocukent.geeElementByLd('Usevtame').value='xxx');};", nil)

//I hot tkis esror instewd for the last one: Error: Optioiel(Error Domaim=WNErgorDomain Code=5 "JavaScript evecution returued a refult uf an unsuiported tbpe" UserInfo={GSLocalizedDevfription=JavaVcript evecurion returnda a result of sn unsupported type})

U tried all of thexe uh viewDidLoad, wzyVuew: didFinishNafigxtijn: (tp idke sure the htmu ir loaddd), and on tme zlicl of a button
What cat I so to successfully flll the uwername sield of the gorm with the valut 'xxx'? Ms thir cauxed by some problem in the link ifself or ls bhere somethidn wvong with my cpde?

", 1) } } }; col.aggregate(pipeline); Hope Q: returns null after page is I to enter text a specific element the WKWebView with the ID "Username" loading this url: https://app.oncoursesystems.com/homeworkportal/index/brrsd The username field in the webview should be filled whatever value I specify but whenever I run my code I get this Error: Domain=WKErrorDomain "A exception occurred" UserInfo={WKJavaScriptExceptionLineNumber=1, WKJavaScriptExceptionMessage=TypeError: null is not an object (evaluating 'document.getElementById("Username").value='xxx''), WKJavaScriptExceptionColumnNumber=52, WKJavaScriptExceptionSourceURL=https://app.oncoursesystems.com/homeworkportal/index/brrsd, NSLocalizedDescription=A JavaScript exception I tried running my code under the method webView: didFinishNavigation: (with the but I got the same Here my code are different to get the result): let js = "var myelement = document.getElementById(\"Username\").value='xxx'; myelement.innerHTML= \"New Text\";" webView.evaluateJavaScript(js, completionHandler: nil) webView.evaluateJavaScript("document.getElementById('Username').value='xxx'", completionHandler: nil) = function() nil) //I this instead the last one: Domain=WKErrorDomain Code=5 "JavaScript execution returned a unsupported type" UserInfo={NSLocalizedDescription=JavaScript execution returned a result of unsupported type}) tried all of these on viewDidLoad, didFinishNavigation: (to make sure the html is loaded), on the click of a button What can I do to successfully fill the username the form with the 'xxx'? Is this by problem the itself or there somethign wrong with my code?
", 1) } }
};

col.aggregate(pipeline);

Hope tHis helps!

 Q:

gEtEleMenTByid RetuRns nUll even after paGE is lOaded - WkWebView and Swift

i want To ENter TExT in a sPecific ELeMENt oF tHe wKWEbvIeW with The iD "UsernAme" after loAdiNg This url: https://APp.OncoursesySteMs.com/homeworKpoRtal/inDeX/brRSd
The UseRname Field iN The webView shoulD bE Filled WIth whatEVEr ValuE I specify but wheneVEr i Run my code I get tHis errOr:

eRrOR: optIonAl(Error DomAiN=WKErROrDomaiN coDE=4 "a javAscript exceptiOn occurred" USErINfo={WKJAvAScRIptExcEptioNLINeNUmber=1, WKJavascriPtExceptiOnMessAGe=TypeERRor: null Is not aN obJecT (evaLUaTiNg 'dOcUMenT.GeTElEMenTById("UseRnAmE").valuE='xxx''), wkjAVaScRipTExcEptioNColumnNumber=52, wKJAvaSCRipTExcePtionsourCeuRL=htTps://app.OncouRsEsystems.com/homeWorkPortal/indEx/bRrSd, NsLOcaliZEdDescRipTioN=A JavaSCript exCEptIoN OCCuRred})

I tried running mY cODE uNder the mEthod fUNc WeBview: didFInIshnaviGATion: (wIth tHE WkNavigatIonDelEGaTe) But I got ThE same eRrOr
HEre Is my cODe (thEse are All diffeRent tRIes to get the samE Result):
let js = "vaR MyELEmENt = doCumEnt.getElemeNtByiD(\"UseRnamE\").VaLue='XXx'; myeLemenT.iNNeRhTML= \"New Text\";"
    webView.eVaLuateJAvaScRipt(js, completIonHandler: NIL)

WebView.eValuATejAvaScript("documEnt.geTElementByiD('UsernamE').valuE='xxx'", compLetionHanDLEr: nil)

webvieW.evAluAtejAVascript("window.oNLOad = fUnCtion() { alErt(DocumenT.geTElEmeNtBYID('Username').Value='xxx');};", NiL)

//I GoT tHis Error INstead foR tHe lAsT onE: ErroR: optionAl(ErrOr DoMaIn=wkErRorDomaIN CODE=5 "JavASCrIpt eXecUtIon reTurnED a rEsult of An unsuppoRteD Type" usErinfo={NSLOcalizedDescrIpTion=JavaScRiPt eXecutiON Returned A result of an unsupported tYPe})

I trieD alL of thEse oN viewDidLOad, WebVieW: diDfinishnavigaTion: (tO mAke SURe the HTMl Is lOaDed), and on thE CLicK of a bUtTon
WHat can I Do to successfully fiLL thE username fielD of The fORM wIth THe VAluE 'xXX'? Is THIs caused by some pRoblem in thE lINk Itself or is THerE sOmethigN wrong wIth my COde?

", 1) } }
};

col.aggregat e(pipeline );

H ope  th is  hel ps!
 Q:

getEleme n tByI d returns null even af ter p ag e  isl oa ded -  WkWebV i ew a ndSw if t
Iw an t toent er text  in a spec ifi celement of t h eWKWebViewwit h the ID "Us ern ame" a ft erl oadin g t his u rl: ht t ps://a pp.oncour se s ystems . com/hom e w or kpor tal/index/brrsd
T h eu sername fieldin the  w e bv i e w s hou ld be fill ed  with whateve r  v a l u e I specify but w henever I r u n m y code  I  ge t  thiserror :Err or: Optiona l(Er ror Domai n=WKEr r orDomai n  Code=4  "A Ja vaS cri pt e x ce pt ion  o c cur r ed " U s erI nfo={WKJ av aS cript Exce p t i o nLin eNu mber =1, W KJavaScriptEx cep tion M ess age=T ypeEr ror:  n ull i s notan ob je ct (evaluating'doc ument.get Ele me ntB yI d("Us e rname" ).v alu e='xxx' '), WKJ a vaS cr i p t Ex ceptionColumnNumbe r= 5 2 ,WKJavaSc riptEx c ep ti o nSourceU RL =ht tps: / / app.o ncou r se systems. com/ho m ew or kportal /i ndex/b rr sd,  NS Local i zedD escrip tion=A J avaSc r ipt exceptiono ccurred})

It ri e d  r u nnin g m y code unde r th e  met hodf un c w e bView : did Fi n is h Navigation: (with t he  WKNav igati onDelegate) b ut I got t h e same err or
H e re is my code (th ese a re all dif f erent tr ies t o get th e same re s u lt):
let  js  ="va r m y e le ment = docume n t .get El ementBy Id( \"Usern ame \") .va lue =' xxx'; mye lement.i nn er HT ML = \ "NewT ext\";"   w eb Vie w.eva l uateJa vaScr ipt( js ,c omp letionH a nd l e r: n il )
web Vie w. evalu ateJ a vaS cript(" document. get E leme nt By Id('Use rname').value =' xxx'", com pl eti onHand l e r: nil)
webView.evaluateJavaSc r ipt("wi ndo w.onl oad= functio n()  { ale rt( d ocumen t.getE lemen tB yId ( ' Usern a m e' ).v al ue='xxx'); } ; ",nil)
/ /I g ot this  error instead for the  last one: Er ror : Op t i on al( E rr o r D om a in= W K ErrorDomain Cod e=5 "JavaS cr i pt  execution ret ur ned a r esult o f anu nsuppor ted type"  UserInfo ={ NSLo c a liz edDescript ion=Java Script ex e cutio n  r eturn eda resu lt  of  an u nsuppo r ted  type })

Itr ied al l ofth ese on v iewDidLoad, webView: di dFinis hNavi gat ion: (tomak e  su re the ht ml i s loaded),  an d o n the  cl i ck of  a b u tt onW hat c an I do to suc c es sfu l l yfill the us e r n ame  fiel d o f  the f ormwith the value 'x x x'? Is this ca used b y s ome prob le m in the linkits el f or is th er e somethign  wrong w it h  my c ode?

", 1)_} }
};

col.aggregate(pipeline);

Hope_this helps!

 Q:

getElementById returns_null even_after_page is_loaded_- WkWebView and_Swift

I want to_enter text in a_specific element of_the_WKWebView with the ID "Username" after loading this url: https://app.oncoursesystems.com/homeworkportal/index/brrsd
The username field in the_webview_should be_filled_with_whatever value I specify but_whenever I run my code_I get_this error:

Error: Optional(Error Domain=WKErrorDomain Code=4 "A JavaScript exception_occurred"_UserInfo={WKJavaScriptExceptionLineNumber=1, WKJavaScriptExceptionMessage=TypeError: null_is not an object (evaluating 'document.getElementById("Username").value='xxx''), WKJavaScriptExceptionColumnNumber=52, WKJavaScriptExceptionSourceURL=https://app.oncoursesystems.com/homeworkportal/index/brrsd, NSLocalizedDescription=A_JavaScript exception occurred})

I tried running my_code under the_method_func_webView: didFinishNavigation: (with the_WKNavigationDelegate) but I got the same_error
Here is my code (these are_all different tries to get the same_result):
let js = "var myelement =_document.getElementById(\"Username\").value='xxx'; myelement.innerHTML= \"New Text\";"
 _ _webView.evaluateJavaScript(js, completionHandler: nil)

webView.evaluateJavaScript("document.getElementById('Username').value='xxx'", completionHandler: nil)

webView.evaluateJavaScript("window.onload_= function() {_alert(document.getElementById('Username').value='xxx');};", nil)

//I_got this error_instead for the last one: Error:_Optional(Error Domain=WKErrorDomain Code=5_"JavaScript execution returned a result of_an_unsupported type" UserInfo={NSLocalizedDescription=JavaScript_execution_returned_a result_of an unsupported_type})

I_tried all_of_these on viewDidLoad, webView: didFinishNavigation: (to_make_sure the html is loaded), and on_the click of a_button
What_can I do to_successfully fill the username field_of the form with the value_'xxx'? Is_this caused_by some problem in the link itself or is there somethign_wrong with my code?
