I am trying to add the button as row element in Pug table.
But button is not getting inserted at specific row
following is the pug code
table
tr#headtag
th DishName
th Quantity
th Currently_Done
th Predicted
th
each order in orders
tr
th=order.dish.name
th=order.numberOfQuantity
th=order.dish.predictedValue
th=order.dish.predictedValue
th=button(class="btn btn-small", type="button") Slett
Getting 'Something failed error' in browser
Without button code is working fine.
table
tr#headtag
th DishName
th Quantity
th Currently_Done
th Predicted
each order in orders
tr
th=order.dish.name
th=order.numberOfQuantity
th=order.dish.predictedValue
th=order.dish.predictedValue
Remove = before button and , (optional) between class and type and try the following instead:
th
button(class="btn btn-small" type="button") Slett
From the docs:
Buffered code starts with =. It evaluates the JavaScript expression
and outputs the result. For security, buffered code is first HTML
escaped.
Therefore th=button(class="btn btn-small", type="button") Slett won't work.
Related
I can't acess a textbox on a webpage box , it's a dynamic element. I've tried to filter it by many attributes on the xpath but it seems that the number that changes on the id and name is the only unique part of the element's xpath. All the filters I try show at least 3 element. I've been trying for 2 days, really need some help here.
from selenium import webdriver
def click_btn(submit_xpath): #clicks on button
submit_box = driver.find_element_by_xpath(submit_xpath)
submit_box.click()
driver.implicitly_wait(7)
return
#sends text to text box
def send_text_to_box(box_xpath, text):
box = driver.find_element_by_xpath(box_xpath)
box.send_keys(text)
driver.implicitly_wait(3)
return
descr = 'Can't send this text'
send_text_to_box('//*[#id="textfield-1285-inputEl"]', descr)' #the number
#here is the changeable part on the xpath
:
edit: it worked now with the following xpath //input[contains(#id, 'textfield') and contains(#aria-readonly, 'false') and contains (#class, 'x-form-invalid-field-default')] . Hopefully I found something specific on this element:
You can use partial string to find the element instead of an exact match. That is, in place of
send_text_to_box('//*[#id="textfield-1285-inputEl"]', descr)' please try send_text_to_box('//*[contains(#id,"inputEl")]', descr)'
In case if there are multiple elements that have string 'inputE1' in id, you should look for something else that remains constant(some other property may be). Else, try finding some other element and then traverse to the required input.
I have a custom field with some HTML code in it:
<h1>A H1 Heading</h1>
<h2>A H2 Heading</h2>
<b>Rich Text</b><br>
fsdfafsdaf df fsda f asdfa f asdfsa fa sfd<br>
<ol><li>numbered list</li><li>fgdsfsd f sa</li></ol>Another List<br>
<ul><li>bulleted</li></ul>
I also have another non-stored field where I want to display the plain text version of the above using REGEXP_REPLACE, while preserving the carriage returns/line breaks, maybe even converting <br> and <br/> to \r\n
However the patterns etc... seem to be different in NetSuite fields compared to using ?replace(...) in freemarker... and I'm terrible with remembering regexp patterns :)
Assuming the html text is stored in custitem_htmltext what expression could i use as the default value of the NetSuite Text Area custom field to display the html code above as:
A H1 Heading
A H2 Heading
Rich Text
fsdfafsdaf df fsda f asdfa f asdfsa fa sfd
etc...
I understand the bulleted or numbered lists will look crap.
My current non-working formula is:
REGEXP_REPLACE({custitem_htmltext},'<[^<>]*>','')
I've also tried:
REGEXP_REPLACE({custitem_htmltext},'<[^>]+>','') - didn't work
When you use a Text Area type of custom field and input HTML, NetSuite seems to change the control characters ('<' and '>') to HTML entities ('<' and '>'). You can see this if you input the HTML and then change the field type to Long Text.
If you change both fields to Long Text, and re-input the data and formula, the REGEXP_REPLACE() should work as expected.
From what I have learned recently, Netsuite encodes data by default to URL format, so from < to < and > to >.
Try using triple handlebars e.g. {{{custitem_htmltext}}}
https://docs.celigo.com/hc/en-us/articles/360038856752-Handlebars-syntax
This should stop the default behaviour and allow you to use in a formula/saved search.
I have gathered obligatory data from the scopus website. my outputs have been saved in a list named "document". when I use type method for each element of this list, the python returns me this class:
"<class'selenium.webdriver.firefox.webelement.FirefoxWebElement'>"
In continius in order to solve this issue, I have used text method such this:
document=driver.find_elements_by_tag_name('td')
for i in document:
print i.text
So, I could see the result in text format. But, when I call each element of the list independently, white space is printed in this code:
x=[]
for i in document:
x.append(i.text)
print (x[2]) will return white space.
What should I do?
As you have used the following line of code :
document=driver.find_elements_by_tag_name('td')
and see the output on Console as :
"<class'selenium.webdriver.firefox.webelement.FirefoxWebElement'>"
This is the expected behavior as Selenium prints the reference of the Nodes matching your search criteria.
As per your Code Attempt to print the text leaving out the white spaces you can use the following code block :
x=[]
document = driver.find_elements_by_tag_name('td')
for i in document :
if (i.get_attribute("innerHTML") != "null") :
x.append(i.get_attribute("innerHTML"))
print(x[2])
My code was correct. But, the selected elements for displaying were space. By select another element, the result was shown.
I'm having issues where I can easily create a table in Jade if I use a variable that I've defined on the page, but as soon as I try to use anything else it prints a long table of nothing.
For instance I can produce a table with the below code:
table
thead
tr
th Bid ID
th Bid Value
tbody
items = [ {"bid_id":1, "bid_value":1.63},{"bid_id":2, "bid_value":1.75},{"bid_id":3, "bid_value":1.00} ]
each item, i in items
tr
td #{item.bid_id}
td #{item.bid_value}
However when I try to use the following I get a very long table that's completely empty!
table
thead
tr
th Bid ID
th Bid Value
tbody
items = all_bids
each item, i in items
tr
td #{item.bid_id}
td #{item.bid_value}
all_bids contains the exact same JSON as defined explicitly above. If I print it in the Jade view using:
p= all_bids
It prints the array correctly as:
[ {"bid_id":1, "bid_value":1.63},{"bid_id":2, "bid_value":1.75},{"bid_id":3, "bid_value":1.00} ]
Struggling to find any decent documentation on creating tables in Jade so any help would be appreciated!
Thanks!
So... is all_bids an array or maybe it is a json string?? It seems that all_bids is a string in your case. In this case each loops over characters and since characters do not have neither bid_id nor bid_value property you obtain a big and empty table.
Now how did I come up with this stuff?? Let's try to be detectives for a moment, shall we? :) Look at this line: p= all_bids. It produces this output:
[ {"bid_id":1, "bid_value":1.63},{"bid_id":2, "bid_value":1.75},{"bid_id":3, "bid_value":1.00} ]
Normally if it was an array you would get:
"[object Object],[object Object],[object Object]"
because of .toString() call (which happens behind the scene). Therefore all_bids is not an array, it's a string!
When you pass all_bids to Jade, try converting it into an object, i.e. JSON.parse(all_bids);.
This is my jqgrid - $("#list1")
When it loads, i.e. on the gridComplete event, I need to rename the column header texts.
Original column header texts are in this format - Colomn1, Column2 ...
On gridComplete, I change these header texts like this:
$("#list1_Column" + someNumber).text(someText);
However on doing this, I lose the ability to sort columns. Column headers are no longer clickable and hence I cannot sort the grid after this custom programmatic editing.
Similar thing happens when I try changing the texts in the search dropdown list (search modal - using multipleSearch: true)
When, on gridComplete, I change text values in the select list as per the grid column headers, like this -
var select = $('#grid_wrapper #fbox_list1 .ui-widget-content .sf .fields select');
$('#grid_wrapper #fbox_list1 .ui-widget-content .sf .fields select option').remove();
$.each(data, function (i, item) {
select.append('<option value="Column' + item.id + '">' + item.ColumnName + '</option>')
});
...I lose the ability to perform multiple search, i.e. the + and - buttons in the search modal disappear.
How do I get around these two issues? Retaining ability to sort and perform multiple search after having changed column header and search list text values on load.
Please guide.
The column header <th> element has two child elements: one <span> with the text of the column header and another with the sort icons which are hidden the most time. So if you want to change the text manually you should use another selector
$("#list1_Column" + someNumber+ " > span").text(someText);
If you do so you will change the text on the page, but not change the text in the colNames or in the colModel (if you use label property instead of colNames). The text will be used for example to create Multisearch dialog. You can make changes in the colModel with respect of setColProp method or use getGridParam to get reference to any internal parameter of jqGrid (which are objects like inclusive colNames and colModel) and then make any changes which you need.
The best way in my opinion to solve the described problems is to use setLabel method to change the text in the column header:
$("#list1").jqGrid('setLabel','ColumnName','My new Name');
this will solve both problems.