Contributions
Re: invalid left-hand side in assignment when changing value of cell
https://support.smartbear.com/testcomplete/docs/reference/language/javascript/set-method.html Its suppose to be a $. What is interesting is that when I try to use the %, it autocompletes, but gives me a syntax error right after, I also can't seem to be able to recreate it autocompleting. I realize I did not mention it before, apologies for that but we're using javascript for this project.1.2KViews0likes0CommentsRe: invalid left-hand side in assignment when changing value of cell
So I made some progress, or so i think. function TrimArtNum (ChkArtNumTrim){ Log.Message(ChkArtNumTrim); var counter = Project.Variables.Counter; var ArtNum = Project.Variables.ArtNumChkT.Item(0, counter); ArtNum = aqConvert.VarToStr(ChkArtNumTrim); ArtNum = aqString.Remove(ChkArtNumTrim,0,15); Log.Message("test " + ArtNum); Project.Variables.ArtNumChkT.$set(" Project.Variables.ArtNumChkT", 0, 0, ArtNum); } I added a second variable (ArtNum). Artnum goes trough the code properly. What still remains though is saving this value to the cell. I figured this is where i'd use the set method I've been reading about. However, now I get another error: Error: The object does not support this property or method. It referring to the %set line.1.2KViews0likes0CommentsRe: invalid left-hand side in assignment when changing value of cell
Not entirely sure which variable you are referring too. Theres three variables in this problem. The ArtNumChkT is a table variable. The counter variable, which is an integer. It's simply there to help me go trough the table. Lastly the ChkTrimArtNum is a parameter in the script function. I haven't seen any options to specify that the table or the parameter should be a string so I assume TestComplete figures that out itself. In the Debug mode I can see that it takes and uses the value in the parameter so that should be fine. However the aqString object might not work if it does not consider it a string.1.2KViews0likes0Commentsinvalid left-hand side in assignment when changing value of cell
Hello and welcome to my forum post. I'd love some help and guidance with my current issue. I get this error when running this test, basically what happens is that testcomplete doesn't want to change the value of the cell. In the test it takes a property of the web application. This beeing an article nummer. For example artikelnummer: IN12345. Then using the aqstring.Remove function, it removes the string part of this article nummer. So what is left is just the nummer (ie. 12345). This can then be used to compare to the article nummer in earlier instances. This worked fine when I wasn't using a table to store the article nummers. The reason I am now is because this seems like a practical solution for when theres multiple article numbers involed. (Whenever more than 1 item has been added to the checkout). function TrimArtNum (ChkArtNumTrim){ Log.Message(ChkArtNumTrim); var counter = Project.Variables.Counter; //Project.Variables.ArtNumChkT.$set("Item", 0, 0, ChkArtNumTrim); Project.Variables.ArtNumChkT.Item(0, counter) = aqString.Remove(ChkArtNumTrim,0,15); Log.Message(Project.Variables.ArtNumChkT.Item(0, counter)); } ^The code where I get the error. Now I did some checking myself and from what I see onhttps://community.smartbear.com/t5/TestComplete-Questions/JavaScript-quot-ReferenceError-Invalid-left-hand-side-in/m-p/196706#M5376and onhttps://support.smartbear.com/testcomplete/docs/scripting/specifics/javascript.html#indexed-properties. The set variable function is required. I've tried messing around with that function but I don't seem to get it working. Heres the keyword test that calls and uses the script. Any help is apreciated.1.3KViews0likes5CommentsRe: Need help comparing orderID on a second page
Marsha_R I figured out the problem. It couldn't find the parent object because the parent object had the wrong namemapping. It was still looking for an URL with the ID inside of it. I changed the object ID nummer to be anything using the *. However since this second number was inside a parent, it was still looking for the specific number because the parents namemapping was unaltered. So by changing the namemapping using an *, the test now works as it should. Thanks alot for your help and patience!1.5KViews0likes1CommentRe: Need help comparing orderID on a second page
HeyMarsha_R, Heres what I changed and learned. I selected the contextText to get the number and In the namemapping, I changed it so that it looks for the ContentText but I wildcarded the number that changes out. Now the first number works. I learned that the value It shows in the keyword text is actually just the name it gave to the object and by putting it in quotes, it essentially became hardcode instead. Thanks for helping me there. Now that initial part works smoothly but I'm running into an error on the second variable. See my screenshots. The proces I did is the same for both of them so I'm left somewhat confused. Ran Into this error, trying to check my edits to the value, a bit after changing it. My settings for the first number, which works. Notice that its parent is Chrome. As opposed to Browser, which is the parent of the second number. The second number that doesn't seem to work. Notice Its parent is Browser, I suspect its causing the error. Dont see how I can change that to Chrome. Error I get back after running the test with a different number than 7919. Results if the number is 7919. Seems to me that the wildcard isn't taking on the second number. The error already aludes to this beeing the issue. It seems a bit odd to me because whenever I use the object spy it automatically puts browers in the value rather than chrome. I could try to use a different browser, but ideally it's gonna work regardless of the browser.1.6KViews0likes4CommentsRe: Need help comparing orderID on a second page
HeyMarsha_R I still can not get it to update the order nummer. I've changed it from a code expression to a object property. And although the comparrision part still works, the value just does not get updated, unless I do it manually. I feel like I'm missing something very obvious? I've included a bunch of screenshots, hopefully that will help. Because I've no clue as to what I'm doing wrong. I've tried it with numerous properties, any of them that includes the IDnumber. And most of them work fine if the number is current, but the moment the number changes, it wont find the number as its looking for the older number. So yes it's beeing saved as hardcode. That is the issue but I don't see how its meant to be saved any other way. After selecting the object and selecting a property for it to find on. For example the contentText. It will save it as hard code right away. It wont first relook up that property and register the new number whenever I rerun the test. So what makes sense to me is that we have to give it another property to look for that is NOT the number. Then somehow make it safe the number as the variable so it can be compared later. But that seems like a very akward solution and surely can't be what we have to do. The properties I get to choose from. The ID number object in question: I do very much apreciate the help you've given me so far.1.6KViews0likes6CommentsRe: Need help comparing orderID on a second page
Hello Marsha_R, Thanks for replying, I've managed to make alot of progres using aqScripts. However Its still not entirely working as intended. There is one vital step that is still missing from the test. Currently at the set variable value, It takes the value just once. I was hoping that It would repeat this step everytime the test runs. That way the number would update automatically and everything would work. Now I would have to manually change the number for Testcomplete, whenever the orderID has changed. So basically the test works, as It compares the orderID to the second orderID on the next page. But the variable never updates, so Its comparing the old orderID, not whatever the current orderID is. I'm also worried that if there is a way for It to update the orderID automatically, It will not include the value in quotation marks. If It doesn't do that, It wont be able to store It in the string variable I've made for It. Although I'd imagine aqConvert plays a role in this possible problem. I'm also including a screenshot of one of the scripts I've made, so you can see exactly what I'm working with. The other script does the same thing but for the other orderID.1.6KViews0likes8CommentsNeed help comparing orderID on a second page
Hello, I'm trying to create a keyword test where after completing an order, there is a orderID that gets displayed. On that same page there Is a link that will take an user to the details of the order. Here the number gets displayed once again. I want to make the test in such a way that It checks if both of these orderID numbers are the same. So far I've created a temporary project variable. I use this variable at the beginning of the test to store the value of the orderID. To do this, I've created a set variable command with the mode of object property, using on screen object. I get a few options to choose as value, but none of them have the number, except the clipboard value. This value beeing: Aliases.browser.pageAtaroBvReserveren.textnodeReserveringsnummer7911.MappedName After making the test go the orderdetails page, I've used a property checkpoint using the same proces as before. And comparing the value to the variable with cmpEqual. The value I get out of this is:Aliases.browser.pageAtaroBvBesteldetails.textnodeBestelling7911.MappedName Now In both of these, the number is the same. How do I get It to ignore everything else but the number?Solved1.9KViews0likes10Comments